Compiling the following code snippet with "gcc -gstabs+ -O3 -c" will expose the 
bug:
------------------stabs.c-------------------
int func1(int parm1)
{
        static int func2(void);
        int var1=0;

        if (parm1 == 10) {
                var1=func2();
        }

        return var1;
}

static int func2()
{
        return 20;
}
---------------------------end---------------------------
nm -Can stabs.o:
         U func2  <<<<---- Shouldn't be generated since it is inlined
00000000 t
00000000 d
00000000 b
00000000 n
00000000 N
00000000 N
00000000 n
00000000 T func1
00000000 a stabs.c

-------------------------------------
gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-
checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-
exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.3 20050227 (Red Hat 3.4.3-22.1)

-- 
           Summary: "gcc -gstabs+ -O3" generates erroneous stabs for inlined
                    funcs
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bhavesh at avaya dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


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

Reply via email to