public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/13974] New: [3.4/3.5 regression] bad line marker in debug info
@ 2004-02-02  9:23 mec dot gnu at mindspring dot com
  2004-02-02  9:24 ` [Bug debug/13974] " mec dot gnu at mindspring dot com
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: mec dot gnu at mindspring dot com @ 2004-02-02  9:23 UTC (permalink / raw)
  To: gcc-bugs

A line marker moved to a bad place in the instruction stream (or, relatively, an
instruction moved to a bad place with respect to the line numbers).  This is a
regression from gcc 3.3.2 to gcc gcc-3_4-branch / gcc HEAD.

The test program is:

  void foo ()
  {
    ;
  }

  int main ()
  {
    int a = 1;
    foo ();
    a += 2;
    return 0;
  }

My compile command is "gcc -gdwarf-2 -S".

With gcc 3.3.2, the output is:

        .loc 1 8 0
  .LBB2:
        movl    $1, -4(%ebp)
        .loc 1 9 0
        call    foo
        .loc 1 10 0
        leal    -4(%ebp), %eax
        addl    $2, (%eax)

With gcc HEAD, the output is:

        .loc 1 8 0
        movl    $1, -4(%ebp)
        .loc 1 9 0
        call    foo
        leal    -4(%ebp), %eax
        .loc 1 10 0
        addl    $2, (%eax)

The leal instruction has migrated before the ".loc 1 10 0" location marker.

If the user executes "jump 10" in gdb, then the gcc HEAD version will fail.
Like this:

  gdb a.out
  (gdb) break 9
  (gdb) break 11
  (gdb) run
  (gdb) jump 10
  (gdb) print a

The "jump 10" will fail with gcc HEAD because the "leal" instruction is in the
wrong place with respect to the start of line number 10.

This happens with both dwarf-2 and stabs+.

This may seem contrived, but the gcc documentation does say:

  Without `-O', the compiler's goal is to reduce the cost of
  compilation and to make debugging produce the expected results.
  Statements are independent: if you stop the program with a
  breakpoint between statements, you can then assign a new value to
  any variable or change the program counter to any other statement
  in the function and get exactly the results you would expect from
  the source code.

I narrowed the problem down to this patch:

  http://gcc.gnu.org/ml/gcc-patches/2003-06/msg00430.html

This is a regression from gcc 3.3.2 so I'm marking it P1.

-- 
           Summary: [3.4/3.5 regression] bad line marker in debug info
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P1
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mec dot gnu at mindspring dot com
                CC: gcc-bugs at gcc dot gnu dot org,hubicka at ucw dot cz
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2004-10-13 17:15 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-02  9:23 [Bug debug/13974] New: [3.4/3.5 regression] bad line marker in debug info mec dot gnu at mindspring dot com
2004-02-02  9:24 ` [Bug debug/13974] " mec dot gnu at mindspring dot com
2004-02-02  9:24 ` mec dot gnu at mindspring dot com
2004-02-02  9:25 ` mec dot gnu at mindspring dot com
2004-02-02  9:28 ` pinskia at gcc dot gnu dot org
2004-02-03  5:35 ` drow at gcc dot gnu dot org
2004-02-03  8:27 ` pinskia at gcc dot gnu dot org
2004-03-01  1:52 ` mmitchel at gcc dot gnu dot org
2004-03-11  5:07 ` mmitchel at gcc dot gnu dot org
2004-03-11 17:49 ` jh at suse dot cz
2004-03-13 22:10 ` jh at suse dot cz
2004-03-14  1:29 ` drow at false dot org
2004-03-14 10:12 ` jh at suse dot cz
2004-03-14 17:31 ` drow at false dot org
2004-03-14 17:42 ` jh at suse dot cz
2004-03-25 16:45 ` cvs-commit at gcc dot gnu dot org
2004-03-25 19:31 ` [Bug debug/13974] [3.5 " pinskia at gcc dot gnu dot org
2004-04-04 19:23 ` mec dot gnu at mindspring dot com
2004-08-27 14:47 ` giovannibajo at libero dot it
2004-09-22 18:23 ` [Bug debug/13974] [4.0 " pinskia at gcc dot gnu dot org
2004-09-30 21:26 ` cvs-commit at gcc dot gnu dot org
2004-09-30 21:27 ` hubicka at gcc dot gnu dot org
2004-10-13 17:15 ` mec dot gnu at mindspring dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).