[Bug middle-end/27657] [4.2 regression] bogus undefined reference error to static var with -g and -O

geoffk at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Aug 28 20:44:00 GMT 2006



------- Comment #8 from geoffk at gcc dot gnu dot org  2006-08-28 20:44 -------

(In reply to comment #3)
> Created an attachment (id=12037)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12037&action=view) [edit]
> patch
> 
> It looks like we should bite the bullet and let cgraph code to output the debug
> info....  I am testing the attached patch
> 
It looks like this patch will prevent the output of debug information for
variables that are optimized out, but that's wrong; the variables should be
visible to the user in the debugger even if they are optimized away.

I think the actual problem is that reference_to_unused in dwarf2out.c is
checking TREE_USED and expecting all used variables to be output, but that
doesn't seem to be happening in this case.  Perhaps there is something in
cgraph which can be called to ask if a variable is *really* going to be output?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27657



More information about the Gcc-bugs mailing list