[Bug fortran/37826] gfortran compiled with -gstabs+ on OSX emits incorrect debug information if compiled with -finit-local-zero

chris dot walter at duke dot edu gcc-bugzilla@gcc.gnu.org
Tue Oct 14 21:35:00 GMT 2008



------- Comment #4 from chris dot walter at duke dot edu  2008-10-14 21:33 -------

> To my knowledge OS X also supports DWARF debugging symbols, cf.
> http://gcc.gnu.org/ml/gcc-patches/2007-02/msg00745.html

Hmm.. Well when I try it I get (using gfortran -gdwarf-2) this when I start
gdb:

GNU gdb 6.3.50-20050815 (Apple version gdb-960) (Sun May 18 18:38:33 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin"...Reading symbols for shared
libraries .... done

warning: Could not find object file
"/var/folders/7c/7cla3UxyGe0s8EeGsHNlUU+++TI/-Tmp-//cc8EVMgS.o" - no debug
information available for "testcase.f".


> 
> I might miss something, but the line numbers look OK.
> 
> 
> > The compiler is apparently adding extra code to initizilize
> > the variables but not accounting for it in the line numbers.
> 
> It does and seemingly the debug location used for this is the line of the last
> variable declaration.

Well... As described in the closed bug report the effect is a lot of jumping
around among the declaration statements for more complicated code.  It steps in
both directions (I mean it will go from line 6 to 2 to 7 etc etc) I assumed
this was a problem but it sounds like you are saying these are the lines that
correspond to the assembly code.  

If it is always the case that there is really a one-to-one correspondence
between the source line and what is being cleared it makes sense if you
understand it.  My feeling is that the code that the compiler adds to clear the
variables is different than what is in the source code (which are definitions)
so it shouldn't be trying to step through that source code. The variable
definition isn't really the same as clearing the variable.

I don't remember ever seeing this when debugging in g77 on linux but I take
your word for it.  Perhaps it shouldn't be changed but it is very confusing as
it is quite difficult to tell when the subroutine execution ever begins.

In anycase, I understand your explanation if you would rather not change it. 
It might be worth adding a warning to the documentation.

Thanks.


-- 


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



More information about the Gcc-bugs mailing list