Bug 526841

Summary: .i file name leaks into DWARF decl coords
Product: [Fedora] Fedora Reporter: Roland McGrath <roland>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: jakub
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-10-02 10:09:29 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:
Bug Depends On:    
Bug Blocks: 526977    
Attachments:
Description Flags
preprocessed C++ source none

Description Roland McGrath 2009-10-02 01:36:55 UTC
Created attachment 363411 [details]
preprocessed C++ source

Description of problem:

The cc1plus input file name leaks into some decl coordinates in the DWARF output.  This appears to be a failure of # line parsing in the front end.  (I don't have a C test case off hand, only this C++ one.)

Version-Release number of selected component (if applicable):
gcc-c++-4.4.1-2.fc11.x86_64

How reproducible:
100%

Steps to Reproduce:
1./usr/bin/g++ -D_GNU_SOURCE -DHAVE_CONFIG_H -DIS_LIBDW -I. -I../../../redhat/elfutils/libdw -I.. -I. -I../../../redhat/elfutils/libdw -I../../../redhat/elfutils/libdw/../libelf -I.. -I../../../redhat/elfutils/libdw/../lib -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu++0x -g -S -o ccache.s ccache.i -v
2.fgrep ccache ccache.s
3.It should not have matched
  
Actual results:
"ccache.i" file name appears in emitted DWARF.

Expected results:
Different files from # lines should be associated with those decls.

Additional info:

The input file is from -save-temps, so if the # line sequence is actually wrong then the bug is in cpp.  IMHO the parser for -fpreprocessed should diagnose unbalanced # lines or suchlike if there are such errors and those are discernable.  If the bug is indeed in cpp, then of course it will much harder to deliver the constituents to reproduce it, but I can give instructions for using F11/x86_64 installed headers and a public git checkout of sources.

-v output:
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i586 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.1 20090725 (Red Hat 4.4.1-2) (GCC) 
COLLECT_GCC_OPTIONS='-D_GNU_SOURCE' '-DHAVE_CONFIG_H' '-DIS_LIBDW' '-I.' '-I../../../redhat/elfutils/libdw' '-I..' '-I.' '-I../../../redhat/elfutils/libdw' '-I../../../redhat/elfutils/libdw/../libelf' '-I..' '-I../../../redhat/elfutils/libdw/../lib' '-Wall' '-Werror' '-Wshadow' '-Wunused' '-Wformat=2' '-Wextra' '-std=gnu++0x' '-g' '-S' '-o' 'ccache.s' '-v' '-shared-libgcc' '-mtune=generic'
 /usr/libexec/gcc/x86_64-redhat-linux/4.4.1/cc1plus -fpreprocessed ccache.i -quiet -dumpbase ccache.i -mtune=generic -auxbase-strip ccache.s -g -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu++0x -version -o ccache.s
GNU C++ (GCC) version 4.4.1 20090725 (Red Hat 4.4.1-2) (x86_64-redhat-linux)
	compiled by GNU C version 4.4.1 20090725 (Red Hat 4.4.1-2), GMP version 4.2.4, MPFR version 2.4.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1cd41dc3ebc262d9c1a9812f1dc31d80
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.4.1/:/usr/libexec/gcc/x86_64-redhat-linux/4.4.1/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.4.1/:/usr/lib/gcc/x86_64-redhat-linux/:/usr/libexec/gcc/x86_64-redhat-linux/4.4.1/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.4.1/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.4.1/:/usr/lib/gcc/x86_64-redhat-linux/4.4.1/:/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.4.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-D_GNU_SOURCE' '-DHAVE_CONFIG_H' '-DIS_LIBDW' '-I.' '-I../../../redhat/elfutils/libdw' '-I..' '-I.' '-I../../../redhat/elfutils/libdw' '-I../../../redhat/elfutils/libdw/../libelf' '-I..' '-I../../../redhat/elfutils/libdw/../lib' '-Wall' '-Werror' '-Wshadow' '-Wunused' '-Wformat=2' '-Wextra' '-std=gnu++0x' '-g' '-S' '-o' 'ccache.s' '-v' '-shared-libgcc' '-mtune=generic'