Bug 50508

Summary: Bad gcc/g++ (.s) output when using -ggdb, -O and -fPIC with stl <queue>
Product: [Retired] Red Hat Linux Reporter: Rune Jortveit <rune.jortveit>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-07-31 19:11:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rune Jortveit 2001-07-31 19:11:34 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010701

Description of problem:
Any -Ox with x > 0 together with -fPIC and -ggdb will make gcc(both 2.96.81
& 2.96.85) produce bad assembler code for the following c++ source:

---- start c++ ----
#include <queue>

queue<int> qiDummy1;
queue<int> qiDummy2;
---- end c++ ----

[~/work/gccbug] 16: gcc -v -c -fPIC -O3 -ggdb test.cpp
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c++ -D__GNUG__=2
-D__EXCEPTIONS -v -D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0
-D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix
-D__linux -Asystem(posix) -D__OPTIMIZE__ -Acpu(i386) -Amachine(i386) -Di386
-D__i386 -D__i386__ -D__tune_i386__ -D__PIC__ -D__pic__ test.cpp
/tmp/cctDAdBn.ii
GNU CPP version 2.96 20000731 (Red Hat Linux 7.1 2.96-85) (cpplib) (i386
Linux/ELF)
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
ignoring duplicate directory "/net/devdisk/linux/include"
ignoring duplicate directory "/usr/lib/qt-2.3.0/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 /net/devdisk/linux/include
 /usr/lib/qt-2.3.0/include
 /usr/include/g++-3
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1plus /tmp/cctDAdBn.ii -quiet
-dumpbase test.cpp -ggdb -O3 -version -fPIC -o /tmp/ccaLb3DH.s
GNU C++ version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
(i386-redhat-linux) compiled by GNU C version 2.96 20000731 (Red Hat Linux
7.1 2.96-85).
 as -V -Qy -o test.o /tmp/ccaLb3DH.s
GNU assembler version 2.10.91 (i386-redhat-linux) using BFD version 2.10.91.0.2
/tmp/ccaLb3DH.s: Assembler messages:
/tmp/ccaLb3DH.s:5349: Error: Rest of line ignored. First ignored character
is `@'.
(rune@ws002 21:07:30)
[~/work/gccbug] 17:

How reproducible:
Always

Steps to Reproduce:
1. Make test.cpp with the following contents
> #include <queue>
>
> queue<int> qiDummy1;
> queue<int> qiDummy2;

2. Try to compile file with 'gcc -c -fPIC -O3 -ggdb test.cpp'

3. Done


Actual Results:

Expected Results:

Additional info:

1. Removing either -O, -fPIC or -ggdb should make the code snippet compile.
2. I haven't experienced this bug with any other STL container.
3. Occured with both 2.96.81 and 2.96.85

Comment 1 Jakub Jelinek 2001-08-09 11:25:01 UTC
Cannot reproduce this with gcc-2.96-95.