This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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: debug/5271: Wrong line number information.


How-To-Repeat:
Call the following preprocessed file "bug.ii"

# 14 "libcwd.tst/leak.cc"
# 206 "../include/libcw/macro_AllocTag.h"
__inline__
int
foo(int i)
{
  i += 1234;
  return i;
};
# 19 "libcwd.tst/leak.cc"

int main(void)
{
  int t = foo(*new int);
  return t;
}

Next compile this file with a command like:

~/c++/libcw/src/libcwd/testsuite>/usr/local/gcc-3.0.3/lib/gcc-lib/i686-pc-linux-gnu/3.0.3/cc1plus -fpreprocessed bug.ii -quiet -dumpbase leak.cc -gdwarf-2 -O -version -o bug.s
GNU CPP version 3.0.3 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0.3 (i686-pc-linux-gnu)
        compiled by GNU C version 3.0.3.

This will result in a file bug.s that shows that
the line number information is such that the call
to 'new int' appears to be made in macro_AllocTag.h
while obviously it is done in main() in leak.cc.

main:
.LFB1:
        .file 2 "libcwd.tst/leak.cc"
        .loc 2 21 0
        pushl   %ebp
.LCFI0:
        movl    %esp, %ebp
.LCFI1:
        subl    $8, %esp
.LCFI2:
        andl    $-16, %esp
.LBB2:
        .loc 2 22 0
        .file 3 "../include/libcw/macro_AllocTag.h"
        .loc 3 209 0
.LBB3:
        subl    $12, %esp
        pushl   $4
.LCFI3:
        call    _Znwj
        addl    $16, %esp
        .loc 3 210 0
        movl    (%eax), %eax
        addl    $1234, %eax
.LBE3:
        .loc 2 23 0
.LBE2:
        .loc 2 24 0
        movl    %ebp, %esp
        popl    %ebp
        ret

Clearly, the line ".loc 3 209 0" should not be there.
 
-- 
Carlo Wood <carlo@alinoe.com>


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