4.0 regression: missing debug info for global variables in C with -O2

Ulrich Weigand uweigand@de.ibm.com
Mon May 30 20:50:00 GMT 2005


Andrew Pinski wrote:

> You can reproduce it using:
> static int i;
> int main(void)
> {
>    i += 3;
>    i *= 5;
>    return 0;
> }
> 
> and readelf and looking for the DW_TAG_variable tag.

Yes; in fact 'main' is even superfluous.  Just compile

  int var;

with -S -O2 -g on gcc 3.4 and 4.0 and look at the resulting
assembler file, the difference is quite obvious ...

Bye,
Ulrich


-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  Ulrich.Weigand@de.ibm.com



More information about the Gcc mailing list