This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR c++/25010
Mark Mitchell <mark@codesourcery.com> writes:
| Andrew Pinski wrote:
| >>In general, the optimizers need to be careful to interpret
| >>DECL_EXTERNAL as meaning "do not output in this translation unit", and
| >>not as "no definition is available in this translation unit".
| >
| >
| > tree.h has this comment:
| > /* In a VAR_DECL or FUNCTION_DECL, nonzero means external reference:
| > do not allocate storage, and refer to a definition elsewhere. */
| >
| > which means no definition is avilable in this TU or at least the way
| > I am reading it.
|
| Maybe the documentation should change, but the way you are reading it is
| certainly not what DECL_EXTERNAL means, or has meant in some time.
I, too, am confused about what DECL_EXTERNAL really means. With
-fdump-translation-unit, I regularly see
body: undefined
because DECL_EXTERNAL was set, see tree-dump.c:
case FUNCTION_DECL:
dump_child ("args", DECL_ARGUMENTS (t));
if (DECL_EXTERNAL (t))
dump_string_field (di, "body", "undefined");
and later,
body: @xxx
because DECL_SAVED_TREE is also set
if (DECL_LANG_SPECIFIC (t) && !dump_flag (di, TDF_SLIM, t))
dump_child ("body", DECL_SAVED_TREE (t));
So, there seems to be an inconsistent practice in the compiler; I
don't which is right and which is wrong.
-- Gaby