On Wed, Mar 17, 2010 at 06:40:30PM +0100, Richard Guenther wrote: > > <var_decl 0x7ffff794d140 __BLNK__ > > type <record_type 0x7ffff79493f0 SI > > size <integer_cst 0x7ffff7854988 constant 32> > > unit size <integer_cst 0x7ffff7854690 constant 4> > > align 32 symtab 0 alias set -1 canonical type 0x7ffff79493f0 > > fields <field_decl 0x7ffff7946d10 i type <integer_type > > 0x7ffff7863498 integer(kind=4)> > > decl_2 SI file a.f90 line 4 col 0 size <integer_cst > > 0x7ffff7854988 32> unit size <integer_cst 0x7ffff7854690 4> > > align 32 offset_align 128 > > offset <integer_cst 0x7ffff78546b8 constant 0> > > bit offset <integer_cst 0x7ffff7854d98 constant 0> context > > <record_type 0x7ffff79493f0>>> > > public static ignored common decl_3 SI defer-output file a.f90 line > > 5 col 0 size <integer_cst 0x7ffff7854988 32> unit size <integer_cst > > 0x7ffff7854690 4> > > align 128 context <function_decl 0x7ffff794b300 test> chain > > <var_decl 0x7ffff794d0a0 i.1>> > > > > Are you suggesting we remove the entire code path here: > > > > /* Try harder to get a rtl. If this symbol ends up not being emitted > > in the current CU, resolve_addr will remove the expression referencing > > it. */ > > > > ?? > > Yes.
That will very much pessimize debug info. While we are now always in -funit-at-a-time mode, that doesn't mean DECL_RTL is computed early enough. >From the file scope non-static vars, at the point debug info is generated only the first var usually has DECL_RTL set, all others don't. For the cfgexpand.c occurence of this idiom, please see e.g. PR41353 - even simple testcases like: int i = 1, j, k = 1; int foo (void) { int i1 = 2 * i; int i2 = 2 * i; int k1 = 2 * k; int k2 = 2 * k; return j; } (and note this is artificial testcase, while obviously if the function does something real, the same problem will be present often too) will have value just for i1/i2, but not for k1/k2. i above has DECL_RTL set in notice_global_symbol, but all other such vars have DECL_RTL set only way after debuginfo for foo is created (unless the function has non-optimized out references to the vars). As we can't create DECL_RTL just for -g case and at different time for -g0, we do the DECL_RTL + SET_DECL_RTL NULL hack. Jakub