This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc HEAD moves line number directives -- gcc bug?


On Mon, Sep 01, 2003 at 01:13:55PM -0400, Michael Elizabeth Chastain wrote:
> Look at the code near 'call foo'.  In gcc 3.3.1, the .loc lines
> match the source code.  In gcc HEAD, the .loc line for line 24
> has migrated.
> 
> Source code:
> 
>   /* 23 */   foo ();
>   /* 24 */   a += 2;
> 
> gcc 3.3.1 output:
> 
>           .loc 1 23 0
>           call  foo
>           .loc 1 24 0
>           leal  -4(%ebp), %eax
>           addl  $2, (%eax)
> 
> gcc HEAD output:
> 
>           .loc 1 23 0
>           call  foo
>           leal  -4(%ebp), %eax          // this insn is part of line 24
>           .loc 1 24 0                   // this moved!
>           addl  $2, (%eax)
> 
> This happens with explicit "-O0" in the command line.
> 
> This causes some mild confusion with gdb.  Specifically, an 'until'
> command on foo returns and says it is on line 24 with gcc 3.3.1,
> but on line 23 with gcc HEAD.
> 
> I isolated the patch that caused this:
> 
>   http://gcc.gnu.org/ml/gcc-patches/2003-06/msg00430.html
>   Jan Hubicka - Line number handling in RTL reorganization
> 
> Do you think this is a bug in gcc?  I do, but I need to check here
> before filing a bug report with gcc.

Maybe, maybe not... our testsuite certainly must accept returning to
both line 23 and 24.  There are a number of architecures where a
function call includes instructions after the return (stack adjustment,
$gp reload...).

Line 24 is the addl.  The leal is generated probably in reload; it's
not really part of any line, even though it was generated for line 24.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]