This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/36524] New: regression: crash when compiling IdentifierTable.cpp


When I compile IdentifierTable.cpp from clang using gcc 4.3.1 I get a crash,
compiling with gcc 4.2.4 doesn't crash.

If I preprocess it first, and then compile it doesn't crash.
If I move the the llvm-svn/llvm/include files to a different folder it doesn't
crash.
So I am not even able to provide an archive of .cpp and .h files to reproduce
since it depends on folder names.

I will rebuild g++ with debug symbols and see where it crashes.
What --enable-checking setting should I use?

Do you have any other suggestions how to get some files that I could submit
that would reproduce the bug?

$ /usr/bin/g++  -I/home/edwin/llvm-svn/llvm/include
-I/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic  -D_DEBUG
-I/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic/../../include -D_GNU_SOURCE
-D__STDC_LIMIT_MACROS   IdentifierTable.cpp -o IdentifierTable.o -c -O1
In file included from IdentifierTable.cpp:161:
/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic/../../include/clang/Basic/TokenKinds.def:272:
internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.3/README.Bugs> for instructions.


Valgrind shows:
==17940== Invalid write of size 1
==17940==    at 0x9B4D40: (within /usr/lib/gcc/x86_64-linux-gnu/4.3/cc1plus)
==17940==    by 0x9B4FFF: (within /usr/lib/gcc/x86_64-linux-gnu/4.3/cc1plus)
==17940==    by 0x4D1ACD: (within /usr/lib/gcc/x86_64-linux-gnu/4.3/cc1plus)
==17940==    by 0x4570CF: (within /usr/lib/gcc/x86_64-linux-gnu/4.3/cc1plus)
==17940==    by 0x469544: (within /usr/lib/gcc/x86_64-linux-gnu/4.3/cc1plus)
==17940==    by 0x4D615C: (within /usr/lib/gcc/x86_64-linux-gnu/4.3/cc1plus)
==17940==    by 0x68DFAA: (within /usr/lib/gcc/x86_64-linux-gnu/4.3/cc1plus)
==17940==    by 0x4C4F1A5: (below main) (libc-start.c:222)
==17940==  Address 0x227505b36fb6 is not stack'd, malloc'd or (recently) free'd


$ g++ -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-2'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.1 (Debian 4.3.1-2)

Doesn't crash:
$ /usr/bin/g++-4.2  -I/home/edwin/llvm-svn/llvm/include
-I/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic  -D_DEBUG
-I/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic/../../include -D_GNU_SOURCE
-D__STDC_LIMIT_MACROS IdentifierTable.cpp -o IdentifierTable.o -c -O1

$ g++-4.2 -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2
--program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.2.4 (Debian 4.2.4-2)

I am unable to reproduce the crash if I first preprocess and then I compile, I
tried:
$ /usr/bin/g++ -v -I/home/edwin/llvm-svn/llvm/include
-I/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic  -D_DEBUG
-I/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic/../../include -D_GNU_SOURCE
-D__STDC_LIMIT_MACROS   IdentifierTable.cpp -o IdentifierTable.o -c -O1
-save-temps
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-2'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.1 (Debian 4.3.1-2)
COLLECT_GCC_OPTIONS='-v' '-I/home/edwin/llvm-svn/llvm/include'
'-I/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic' '-D_DEBUG'
'-I/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic/../../include'
'-D_GNU_SOURCE' '-D__STDC_LIMIT_MACROS' '-o' 'IdentifierTable.o' '-c'
'-save-temps' '-O1' '-shared-libgcc' '-mtune=generic'
 /usr/lib/gcc/x86_64-linux-gnu/4.3.1/cc1plus -E -quiet -v
-I/home/edwin/llvm-svn/llvm/include
-I/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic
-I/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic/../../include -D_GNU_SOURCE
-D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS IdentifierTable.cpp -mtune=generic
-O1 -fpch-preprocess -o IdentifierTable.ii
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.3.1/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/usr/include/x86_64-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /home/edwin/llvm-svn/llvm/include
 /home/edwin/llvm-svn/llvm/tools/clang/lib/Basic
 /home/edwin/llvm-svn/llvm/tools/clang/lib/Basic/../../include
 /usr/include/c++/4.3
 /usr/include/c++/4.3/x86_64-linux-gnu
 /usr/include/c++/4.3/backward
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.3.1/include
 /usr/lib/gcc/x86_64-linux-gnu/4.3.1/include-fixed
 /usr/include
End of search list.
In file included from <built-in>:0:
<built-in>:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.3/README.Bugs> for instructions.

$ /usr/bin/g++ -c -O1 IdentifierTable.ii
In file included from IdentifierTable.cpp:162:
/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic/../../include/clang/Basic/TokenKinds.def:
In member function ?void clang::IdentifierTable::AddKeywords(const
clang::LangOptions&)?:
/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic/../../include/clang/Basic/TokenKinds.def:271:
error: expected `}' at end of input

Ok, so the preprocessed file got truncated, trying again without -O1:
$ /usr/bin/g++  -I/home/edwin/llvm-svn/llvm/include
-I/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic  -D_DEBUG
-I/home/edwin/llvm-svn/llvm/tools/clang/lib/Basic/../../include -D_GNU_SOURCE
-D__STDC_LIMIT_MACROS   IdentifierTable.cpp -o IdentifierTable.o -c 
-save-temps

However the crash won't reproduce with this preprocessed file:
$ /usr/bin/g++ -c -O1 IdentifierTable.ii


-- 
           Summary: regression: crash when compiling IdentifierTable.cpp
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: edwintorok at gmail dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]