Bug 18273 - [3.4 Regression] Fail to generate debug info for member function.
Summary: [3.4 Regression] Fail to generate debug info for member function.
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 3.4.2
: P2 normal
Target Milestone: 3.4.6
Assignee: Not yet assigned to anyone
Keywords: wrong-debug
Depends on:
Reported: 2004-11-02 12:40 UTC by Adam McKee
Modified: 2006-02-28 09:44 UTC (History)
2 users (show)

See Also:
Known to work: 4.0.0
Known to fail: 3.4.0
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Adam McKee 2004-11-02 12:40:19 UTC
g++ fails to generate debug info for some methods.  Please refer to the
following files, posted here: http://www.adam-mckee.net/files/gccbug

TotalCostEvaluator_bug.ii   : to reproduce the bug
TotalCostEvaluator_ok.ii    : my workaround (debug info is generated properly)
readelf_bug.txt             : readELF output shows no debug info generated
    for 'tsPerDay', a local within TotalCostEvaluator::cslistCost()
readelf_ok.txt              : debug info is properly generated for 'tsPerDay'
    as well as all other locals belonging to TotalCostEvaluator::cslistCost().

If you compile TotalCostEvaluator_bug.ii, like this:

=== compilation command =====================================================
g++ -g -march=athlon-xp -Wall -Wno-uninitialized -fstrict-aliasing -c
    -o TotalCostEvaluator.o TotalCostEvaluator.ii

then run 'readelf -wi TotalCostEvaluator.o' - you will see that no debug info
has been generated for any local variables belonging to

I did some testing, and found out that debug info would be properly generated
for cslistCost() if I change the way I write a template function
(deleteMapSecond), which is called by cslistCost().  If you compare
TotalCostEvaluator_ok.ii with TotalCostEvaluator_bug.ii you'll see the change I
made, which apparently causes gcc to generate debug info properly in this case.

This is the first time I filed a bug report for gcc.  I wasn't sure how to
attach files so I thought it easiest to just make the files available from my
web server.

Here's some other information that you might want:

==== gcc -v ===============================================================
adam@chef:/work/gccbug> gcc -v
Reading specs from /usr/lib/gcc/i486-linux/3.4.2/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4
--enable-shared --with-system-zlib --enable-nls --without-included-gettext
--program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk --disable-werror i486-linux
Thread model: posix
gcc version 3.4.2 (Debian 3.4.2-3)

=== uname -a ================================================================
Linux chef.clevor.vpn 2.6.9 #14 Mon Oct 25 19:49:12 CST 2004 i686 GNU/Linux
Comment 1 Andrew Pinski 2004-11-02 14:31:09 UTC
Confirmed but not reduced, it works on the mainline also.
Comment 2 Gabriel Dos Reis 2005-11-21 02:22:00 UTC
Postponed until 3.4.6.
Not release critical.
Comment 3 Gabriel Dos Reis 2006-02-28 09:44:15 UTC
won't fix for 3.4.6.