Bug 4431 - Wrong .stabs entries when using -O2
Summary: Wrong .stabs entries when using -O2
Status: RESOLVED DUPLICATE of bug 5271
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 3.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-09-30 21:16 UTC by carlo
Modified: 2003-10-07 22:51 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description carlo 2001-09-30 21:16:01 UTC
> /usr/local/gcc-3.1/lib/gcc-lib/i686-pc-linux-gnu/3.1/cc1plus -fpreprocessed bug.ii -quiet -dumpbase stabs.cc -g -O2 -Wall -Woverloaded-virtual -Wundef -Wpointer-arith -Wwrite-strings -Werror -Winline -version -o stabs.s
GNU CPP version 3.1 20010930 (experimental) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.1 20010930 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 3.1 20010930 (experimental).

Results in a stabs.s containing:

        .stabs  "../include/libcw/debugmalloc.h",132,0,0,.Ltext2
.Ltext2:
        .stabn 68,0,235,.LM2-main
.LM2:
        movl    $4, (%esp)
        call    _Znwj

Causing debuggers to think that 'new' was called from
debugmalloc.h line 235.

This is obviously not the case (see attached bug.ii file).
This problem does not occur with -O0 or -O1.

bug.ii file:

# 234 "../include/libcw/debugmalloc.h"
template<typename TYPE>
inline TYPE* __libcwd_allocCatcher(TYPE* new_ptr) {
  return new_ptr;
};
 
# 3 "stabs.cc"
 
int main(void)
{
  __libcwd_allocCatcher(new int);
  return 0;
}

Release:
All versions

Environment:
i686-unknown-linux
Comment 1 Wolfgang Bangerth 2002-12-04 07:52:40 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: This still happens, but with newer compilers I have to
    explicitly give -gstabs to provoke this.
Comment 2 Andrew Pinski 2003-06-07 22:31:24 UTC
I think this is related to bug 10003 which was for dwarf-2/3. I think this is generic 
debugging bug caused by the inliner if that is the case then is a dup of 10003.
Comment 3 Andrew Pinski 2003-06-07 22:34:30 UTC
*** Bug 5271 has been marked as a duplicate of this bug. ***
Comment 4 Andrew Pinski 2003-06-17 23:08:56 UTC
I am going to mark this as a dup of 10003 which is the bug against dwarf-2 but the bug is 
caused by the tree-inliner so they both are the same bug.

*** This bug has been marked as a duplicate of 10003 ***
Comment 5 carlo 2003-09-20 15:14:25 UTC
Not a duplicate of 10003.  Also not a duplicate of 12319.
Comment 6 Carlo Wood 2003-10-07 22:51:39 UTC
Although 10003 wasn't related, this is indeed a duplicate
of PR 5271.  I wrote a patch to fix 5271 and confirmed
that it fixes this one too.


*** This bug has been marked as a duplicate of 5271 ***