This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13768] [3.4/3.5 Regression] -funit-at-a-time compiles unused inline function
- From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Feb 2004 08:39:15 -0000
- Subject: [Bug c++/13768] [3.4/3.5 Regression] -funit-at-a-time compiles unused inline function
- References: <20040120110040.13768.igodard@pacbell.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From ebotcazou at gcc dot gnu dot org 2004-02-03 08:38 -------
With -funit-at-a-time, the C++ front-end (decl2.c:maybe_emit_vtables) emits the
vtable for struct X, while it doesn't do so without -funit-at-a-time.
The difference in the behaviour boils down to this macro in cp-tree.h:
/* DECL_NEEDED_P holds of a declaration when we need to emit its
definition. This is true when the back-end tells us that
the symbol has been referenced in the generated code. If, however,
we are not generating code, then it is also true when a symbol has
just been used somewhere, even if it's not really needed. We need
anything that isn't comdat, but we don't know for sure whether or
not something is comdat until end-of-file. */
#define DECL_NEEDED_P(DECL) \
((at_eof && TREE_PUBLIC (DECL) && !DECL_COMDAT (DECL)) \
|| (DECL_ASSEMBLER_NAME_SET_P (DECL) \
&& TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL))) \
|| (((flag_syntax_only || flag_unit_at_a_time) && TREE_USED (DECL))))
According to the comment, it seems that -funit-at-a-time behaves like
-fsyntax-only, that is it may emit DECLs that are not really needed.
--
What |Removed |Added
----------------------------------------------------------------------------
Component|optimization |c++
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13768