This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR 20505


Bug 20505 is an ICE with -ggdb2.  We have the following member
definition,
  const int b::d = ((int)(&((b*)1)->c) - 1);
whose initializer used to be folded during construction to an INT_CST, but
now it doesn't -- fold cannot fold the complete expression.  As
the PR says, this was changed by,

2004-08-30 Richard Henderson <rth@redhat.com>

        * class.c (build_base_path): Use build_address directly.
        * typeck.c (build_unary_op): Don't lower &a.b to pointer
        arithmetic directly.
        * typeck2.c (store_init_value): Don't assume !TREE_CONSTANT
        means !initializer_constant_valid_p.

The dwarf outputter fails when outputting the constant value of that
decl, because it expects an INT_CST.

I was puzzled as to why we don't get the same failure for a similar
struct without a virtual function.  The answer is in that case we don't
defer outputting the debug info when the class is complete. And at that
point the static member has no initializer.  We defer in the virtual case
in an effort to reduce debug data.

My inclination is to simply add an additional check in the dwarf outputter,
verifying that the initializer is indeed an INT_CST.

Am I missing something?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]