[Bug c++/82737] New: Compiler segfault on compilation of a certain file (full cause unknown) (file too large for upload, link provided)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82737 Bug ID: 82737 Summary: Compiler segfault on compilation of a certain file (full cause unknown) (file too large for upload, link provided) Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: brycm001 at gmail dot com Target Milestone: --- This is a bug that manifests itself in a segfault on an attempt to compile Manager.cpp from my GasSim project on MinGW-w64 MSYS2, over Windows 10 64-bit. GCC version: 7.2.0 Output of gcc -v: -- Using built-in specs. COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-7.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev1, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld Thread model: posix gcc version 7.2.0 (Rev1, Built by MSYS2 project) -- My .i file is (far) too big to be uploaded directly, so I'm going to give you a link to where I added it on my git repo: https://bitbucket.org/TheEdenCrazy/gassim/raw/293fc15913df18c79026d4a7084d9d21e3d53597/_share_gcc_bug/Manager.cpp.i -- Error message when running from cmake: C:\msys64\mingw64\bin\cmake.exe --build C:\repos\gassim\cmake-build-debug --target GasSim -- -j 4 [ 3%] Built target Boxer [ 37%] Built target glfw Scanning dependencies of target GasSim [ 41%] Building CXX object CMakeFiles/GasSim.dir/src/Control/Manager.cpp.obj [ 41%] Building CXX object CMakeFiles/GasSim.dir/src/main.cpp.obj [ 41%] Building CXX object CMakeFiles/GasSim.dir/src/Control/DebugHandlers.cpp.obj C:\repos\gassim\src\Control\Manager.cpp: In function 'std::__cxx11::string control::_getGLDebugTypeString(GLenum, GLenum, GLuint, const string&)': C:\repos\gassim\src\Control\Manager.cpp:181:5: internal compiler error: Segmentation fault } ^ libbacktrace could not find executable to open Please submit a full bug report, with preprocessed source if appropriate. See <https://sourceforge.net/projects/msys2> for instructions. mingw32-make.exe[3]: *** [CMakeFiles\GasSim.dir\build.make:113: CMakeFiles/GasSim.dir/src/Control/Manager.cpp.obj] Error 1 mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:68: CMakeFiles/GasSim.dir/all] Error 2 mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:80: CMakeFiles/GasSim.dir/rule] Error 2 mingw32-make.exe: *** [Makefile:185: GasSim] Error 2 CMake & make command that produces this error: "cmake -G "MSYS Makefiles" /c/repos/GasSim -DCMAKE_BUILD_TYPE=Debug" then "make -j4 src/Control/Manager.cpp.obj" Raw build command: "/C/msys64/mingw64/bin/g++.exe -DEIGEN_DONT_ALIGN -DGLM_ENABLE_EXPERIMENTAL -I/C/repos/gassim/include -I/C/repos/gassim/ext/glm -I/C/msys64/mingw64/include -I/C/repos/gassim/ext/glad/include -I/C/repos/gassim/ext/CEGUI/cegui/include -I/C/repos/gassim/ext/Boxer/include -I/C/repos/gassim/ext/glfw/include -O2 -static-libstdc++ -g -std=gnu++1z -o CMakeFiles/GasSim.dir/src/Control/Manager.cpp.obj -c /C/repos/gassim/src/Control/Manager.cpp" (I removed eigen from the project though, so the -DEIGEN_DONT_ALIGN part is irrelevant) - Error message on running the single file target: " make -f CMakeFiles/GasSim.dir/build.make CMakeFiles/GasSim.dir/src/Control/Manager.cpp.obj make[1]: Entering directory '/home/Matti/build/GasSim' Building CXX object CMakeFiles/GasSim.dir/src/Control/Manager.cpp.obj /C/msys64/mingw64/bin/g++.exe -DEIGEN_DONT_ALIGN -DGLM_ENABLE_EXPERIMENTAL -I/C/repos/gassim/include -I/C/repos/gassim/ext/glm -I/C/msys64/mingw64/include -I/C/repos/gassim/ext/glad/include -I/C/repos/gassim/ext/CEGUI/cegui/include -I/C/repos/gassim/ext/Boxer/include -I/C/repos/gassim/ext/glfw/include -O2 -static-libstdc++ -g -std=gnu++1z -o
[Bug c++/82737] Compiler segfault on compilation of a certain file (full cause unknown) (file too large for upload, link provided)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82737 Matti Bryce changed: What|Removed |Added Target||x86_64-w64-mingw32 URL||https://bitbucket.org/TheEd ||enCrazy/gassim/src/293fc159 ||13df18c79026d4a7084d9d21e3d ||53597/_share_gcc_bug/Manage ||r.cpp.i?at=master&fileviewe ||r=file-view-default CC| |brycm001 at gmail dot com Host||x86_64-w64-mingw32 Alias||Segfault, on, 7.2.0, MSYS2, ||mingw-w64, debug, symbols Known to fail||7.2.0 --- Comment #1 from Matti Bryce --- Important note: This bug does not appear to occur without -g as a flag (debug)
[Bug c++/82737] [ICE] Compiler segfault on compilation of a certain file (full cause unknown) (file too large for upload, link provided)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82737 --- Comment #6 from Matti Bryce --- I have figured out more information. For some reason the build command in the log was (erroneously) listed as -O2, but the actual trigger of the segfault is -O3. I am running creduce right now, but the size of the file means that it is going to take many many hours more. However, I have uploaded the .i.cpp file and the python3 detector script so you can easily run it if you have a more beefy computer. The folder containing all 3 things is: https://bitbucket.org/TheEdenCrazy/gassim/src/a01812e2f7d95e667f67d400bb9d57caad1a5709/_gcc_bug_test/?at=master (just cp Manager.cpp.i -> Manager.cpp.i.cpp), then do creduce ./attempt_compilation.sh Manager.cpp.i.cpp To reduce it.
[Bug c++/82737] [ICE] Compiler segfault on compilation of a certain file (full cause unknown) (file too large for upload, link provided)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82737 --- Comment #7 from Matti Bryce --- (In reply to Martin Liška from comment #5) > Confirmed with cross compiler, I reduce a test-case. I've attempted to reduce a test case, but after 2 days of running creduce, the produced file won't generate the error. I'm going to run gdb now.(In reply to Martin Liška from comment #5), and see if I can do anything with it (though if someone could give me tips for what to look for, that'd be great).
[Bug c++/82737] [ICE] Compiler segfault on compilation of a certain file (full cause unknown) (file too large for upload, link provided)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82737 --- Comment #8 from Matti Bryce --- Created attachment 42496 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42496&action=edit Backtrace
[Bug c++/82737] [ICE] Compiler segfault on compilation of a certain file (full cause unknown) (file too large for upload, link provided)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82737 --- Comment #9 from Matti Bryce --- (In reply to Martin Liška from comment #2) > Hi. I can't build your pre-process source file. Please follow steps to > reduce the segfault: > https://gcc.gnu.org/wiki/A_guide_to_testcase_reduction > > And please try to run it in gdb (adding -wrapper gdb,--args), and print > back-trace. Thanks. I added a backtrace (though my GCC doesn't have debug symbols). It seems the stack is corrupt at some point.
[Bug c++/82737] [ICE] Compiler segfault on compilation of a certain file (full cause unknown) (file too large for upload, link provided)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82737 --- Comment #10 from Matti Bryce --- If anyone knows how to get gcc with debug symbols, that'd be useful, because I could get a better stack trace.
[Bug c++/82737] [ICE] Compiler segfault on compilation of a certain file (full cause unknown) (file too large for upload, link provided)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82737 --- Comment #14 from Matti Bryce --- (In reply to Martin Liška from comment #12) > (In reply to Matti Bryce from comment #7) > > (In reply to Martin Liška from comment #5) > > > Confirmed with cross compiler, I reduce a test-case. > > > > I've attempted to reduce a test case, but after 2 days of running creduce, > > the produced file won't generate the error. > > Hi. Looks you hit stack overflow. In that case, please use ulimit and set > smaller stack, that will simplify the reduction. You have to properly write > creduce script that will catch the ICE: > https://gcc.gnu.org/wiki/A_guide_to_testcase_reduction > > And please use -fmax-errors=1 which will guarantee that reduced test-case > will be a valid code. > > Please either download debug symbols for GCC package. Or build your own from > source: https://gcc.gnu.org/install/configure.html > > Feel free to ask for questions.. There are no debug symbols available, so I'm going to have to build gcc. But I can't find the configure option on https://gcc.gnu.org/install/configure.html, so if you could tell me the flag to use to enable debug symbols, that would be helpful. I'm running creduce again, so I'll get back to you on that once it has finished running. Thanks. Thanks.
[Bug c++/82737] [ICE] Compiler segfault on compilation of a certain file (full cause unknown) (file too large for upload, link provided)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82737 --- Comment #17 from Matti Bryce --- (In reply to Martin Liška from comment #16) > Matti: Any progress with the reduction? Yeah, it's reduced about 20% or so. But it's taken several days just to get this far, so it's going to be quite a while before anything usefully small come of it.