> and we have a CTOR and not individual initializations because of Erics
> const-pool changes I believe.
No, we have the constructor with GCC 4.5 as well, my patch only makes it go through tree_output_constant_def.
> &p->a is folded to &1241530624B->a even before gimplification (but
> &1241530624B->a is "unfolded" - it's an obfuscated constant).
>
> We ICE from
>
> #0 fancy_abort (
> file=0x1252a70 "/space/rguenther/src/svn/gcc-4_6-branch/gcc/varasm.c",
> line=2638, function=0x1253700 "decode_addr_const")
> at /space/rguenther/src/svn/gcc-4_6-branch/gcc/diagnostic.c:893
> #1 0x0000000000ca9016 in decode_addr_const (exp=0x2aaaaceb3fc0,
> value=0x7fffffff9b30)
> at /space/rguenther/src/svn/gcc-4_6-branch/gcc/varasm.c:2638
> #2 0x0000000000ca97f0 in const_hash_1 (exp=0x2aaaaceb3fc0)
> at /space/rguenther/src/svn/gcc-4_6-branch/gcc/varasm.c:2734
> #3 0x0000000000ca95db in const_hash_1 (exp=0x2aaaacea54e0)
> at /space/rguenther/src/svn/gcc-4_6-branch/gcc/varasm.c:2724
> #4 0x0000000000cace7a in tree_output_constant_def (exp=0x2aaaacea54e0)
> at /space/rguenther/src/svn/gcc-4_6-branch/gcc/varasm.c:3302
> #5 0x000000000083a5f4 in gimplify_init_constructor (expr_p=0x7fffffffb3a8,
> pre_p=0x7fffffffccf8, post_p=0x7fffffffa928, want_value=0 '\000',
> notify_temp_creation=0 '\000')
> at /space/rguenther/src/svn/gcc-4_6-branch/gcc/gimplify.c:3833
>
> and fold &p->a via c_fully_fold_internal.
This is a known issue, namely that tree_output_constant_def rejects offsetof computations. See PR middle-end/44100 for an example with the C++ compiler.
I think this should be folded in the front-end - c_fully_fold is kind of a misnomer if it can only partially fold &p->a. It's just a matter of copying
the chunk of code present in build_unary_op, no big deal IMO.
And this compiles fine in C++ because the folding is done:
> and we have a CTOR and not individual initializations because of Erics
> const-pool changes I believe.
No, we have the constructor with GCC 4.5 as well, my patch only makes it go through tree_output_ constant_ def.
> &p->a is folded to &1241530624B->a even before gimplification (but rguenther/ src/svn/ gcc-4_6- branch/ gcc/varasm. c", addr_const" ) rguenther/ src/svn/ gcc-4_6- branch/ gcc/diagnostic. c:893 3fc0, f9b30) rguenther/ src/svn/ gcc-4_6- branch/ gcc/varasm. c:2638 3fc0) rguenther/ src/svn/ gcc-4_6- branch/ gcc/varasm. c:2734 54e0) rguenther/ src/svn/ gcc-4_6- branch/ gcc/varasm. c:2724 constant_ def (exp=0x2aaaacea 54e0) rguenther/ src/svn/ gcc-4_6- branch/ gcc/varasm. c:3302 init_constructo r (expr_p= 0x7fffffffb3a8, fccf8, post_p= 0x7fffffffa928, want_value=0 '\000', temp_creation= 0 '\000') rguenther/ src/svn/ gcc-4_6- branch/ gcc/gimplify. c:3833 fold_internal.
> &1241530624B->a is "unfolded" - it's an obfuscated constant).
>
> We ICE from
>
> #0 fancy_abort (
> file=0x1252a70 "/space/
> line=2638, function=0x1253700 "decode_
> at /space/
> #1 0x0000000000ca9016 in decode_addr_const (exp=0x2aaaaceb
> value=0x7ffffff
> at /space/
> #2 0x0000000000ca97f0 in const_hash_1 (exp=0x2aaaaceb
> at /space/
> #3 0x0000000000ca95db in const_hash_1 (exp=0x2aaaacea
> at /space/
> #4 0x0000000000cace7a in tree_output_
> at /space/
> #5 0x000000000083a5f4 in gimplify_
> pre_p=0x7ffffff
> notify_
> at /space/
>
> and fold &p->a via c_fully_
This is a known issue, namely that tree_output_ constant_ def rejects offsetof computations. See PR middle-end/44100 for an example with the C++ compiler.
I think this should be folded in the front-end - c_fully_fold is kind of a misnomer if it can only partially fold &p->a. It's just a matter of copying
the chunk of code present in build_unary_op, no big deal IMO.
And this compiles fine in C++ because the folding is done:
Starting program: /home/eric/ build/gcc/ native/ gcc/cc1plus -quiet pr50266.c -quiet -mtune=generic -march=x86-64 -Os
Breakpoint 1, tree_output_ constant_ def (exp=0x7ffff6ed bdf8) svn/gcc/ gcc/varasm. c:3295 expr(exp)
at /home/eric/
3295 key.value = exp;
(gdb) p debug_generic_
{1241530624B, 1241530628B, 0B}