[Bug c++/67055] New: Segmentation fault in fold_builtin_alloca_with_align in tree-ssa-ccp.c
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67055 Bug ID: 67055 Summary: Segmentation fault in fold_builtin_alloca_with_align in tree-ssa-ccp.c Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bal...@yahoo-inc.com Target Milestone: --- Created attachment 36087 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36087&action=edit This is the full output from the build with stdout and stdin redirected to file. When upgrading our compiler version from 4.9.3 to 5.2.0 our build fails with following message. In file included from mallocdst16.cpp:31:0: ../../vespamalloc/malloc/overload.h: In function ‘void* operator new(std::size_t, const std::nothrow_t&)’: ../../vespamalloc/malloc/overload.h:41:7: internal compiler error: Segmentation fault void* operator new(std::size_t sz, const std::nothrow_t&) noexcept { ^ 0xa34c65 crash_signal ../.././gcc/toplev.c:383 0xaf7486 fold_builtin_alloca_with_align ../.././gcc/tree-ssa-ccp.c:2066 0xaf7486 ccp_fold_stmt ../.././gcc/tree-ssa-ccp.c:2172 0xb6738a substitute_and_fold_dom_walker::before_dom_children(basic_block_def*) ../.././gcc/tree-ssa-propagate.c:1176 0xfcdd3a dom_walker::walk(basic_block_def*) ../.././gcc/domwalk.c:188 0xb65a1b substitute_and_fold(tree_node* (*)(tree_node*), bool (*)(gimple_stmt_iterator*), bool) ../.././gcc/tree-ssa-propagate.c:1272 0xaf196b ccp_finalize ../.././gcc/tree-ssa-ccp.c:941 0xaf2adf do_ssa_ccp ../.././gcc/tree-ssa-ccp.c:2382 0xaf2adf execute ../.././gcc/tree-ssa-ccp.c:2414 Please submit a full bug report, ... ...
[Bug c++/67055] Segmentation fault in fold_builtin_alloca_with_align in tree-ssa-ccp.c
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67055 --- Comment #2 from Henning Baldersheim --- Created attachment 36088 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36088&action=edit the .ii file in gziped format
[Bug c++/67055] Segmentation fault in fold_builtin_alloca_with_align in tree-ssa-ccp.c
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67055 --- Comment #3 from Henning Baldersheim --- Created attachment 36089 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36089&action=edit .s file I also add the .s file that was generated with the -save-temps option
[Bug c++/67055] Segmentation fault in fold_builtin_alloca_with_align in tree-ssa-ccp.c
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67055 --- Comment #4 from Henning Baldersheim --- If I use -O2 instead of -O3 it builds fine.
[Bug c++/67055] Segmentation fault in fold_builtin_alloca_with_align in tree-ssa-ccp.c
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67055 --- Comment #5 from Henning Baldersheim --- Actually -fno-inline-functions was enough as a workaround. Then I can still use the same general -O3 option.
[Bug c++/67056] New: Wrong code generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67056 Bug ID: 67056 Summary: Wrong code generated Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bal...@yahoo-inc.com Target Milestone: --- Yes, I know a very bad summary. I need some help to narrow it down. When upgrading compile from 4.9.3 to 5.2 1 of our unit tests started failing with segmentation fault. It compiles fine, but generates bad code. There are no warning neither with 4.9.3 nor with 5.2. We are also running the unit tests with latest valgrind. With 5.2 valgrind complains about accessing deleted memory. I am not sure how I best can provide you with what you need in order to investigate this as it fails at runtime and the unit test uses other shared libraries. Any suggestions ? I have made the following observations. 1 - We are building with -O3. The issue is also present at -O2. However if I add -fno-tree-vrp it improves. Then there is no segmentation fault, but valgrind complains about a memory leak. It fails to run a destructor. 2 - I can fix the issue by reordering members in one class from ConfigSnapshot snap; std::atomic configured; std::atomic throwException; to std::atomic configured; std::atomic throwException; ConfigSnapshot snap; Then valgrind is happy to. No need for tinkering with the compile flags. 3 - I move the implementation of the destructor and the constructor out of the class definition and add __attribute__((noinline)) to them. Then everything works perfectly too. What can I provide that can help you investigate this ? This is the compile command for the unit test. The code that I mention in 2 and 3 are both contained in the file compiled here. g++ -g -O3 -Wuninitialized -Werror -Wall -W -Wchar-subscripts -Wcomment -Wformat -Wparentheses -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DGCC_X86_64 -fPIC -D_GLIBCXX_USE_CXX11_ABI=0 -DBOOST_DISABLE_ASSERTS -march=westmere -mtune=intel -Wnon-virtual-dtor -std=c++14 -fvisibility-inlines-hidden -DNOT_BOOST_SPIRIT_THREADSAFE=1 -DNOT_PHOENIX_THREADSAFE=1 -DBOOST_NO_AUTO_PTR=1-I../.. -I"/home/balder/build/lz4-PREINST/lz4-install/include" -I/home/balder/build/staging_vespalib-HEAD/staging_vespalib-install/include -I"/home/balder/build/ytracelib-PREINST/ytracelib-install/include" -I/home/balder/build/fastlib-HEAD/fastlib-install/include -I/home/balder/build/fnet-HEAD/fnet-install/include -I/home/balder/build/vespalib-HEAD/vespalib-install/include -isystem /home/balder/build/llvm-PREINST/llvm-install/include -isystem /home/balder/build/boost-PREINST/boost-install/include/ -I/home/balder/build/vespalog-HEAD/vespalog-install/include -I/home/balder/build/fastos-HEAD/fastos-install/include -DV_TAG_DATE='"20150729.142010"' -DV_TAG_YINST='"5.81.0.20150729.142010"' -DV_TAG_COMPONENT='"5.81.0"' -DV_TAG_ARCH='"x86_64"' -DV_TAG_SYSTEM='"Linux"' -DV_TAG_SYSTEM_REV='"rhel-6.6"' -DV_TAG_BUILDER='"bal...@honda.trondheim.corp"' -DV_TAG='"CURRENT"' -c configretriever.cpp -o configretriever.o g++ -v [balder@honda configretriever]$ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/home/y/bin64/../libexec/gcc/x86_64-redhat-linux/5.2.0/lto-wrapper Target: x86_64-redhat-linux Configured with: ./configure --prefix=/home/y --enable-languages=c,c++ --host=x86_64-redhat-linux --build=x86_64-redhat-linux --target=x86_64-redhat-linux --disable-bootstrap LDFLAGS='-Wl,-rpath,/home/y/lib64 -L/home/y/lib64' --with-mpc=/home/y --with-gmp=/home/y --with-mpfr=/home/y Thread model: posix gcc version 5.2.0 (GCC)
[Bug c++/67056] Wrong code generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67056 --- Comment #3 from Henning Baldersheim --- valgrind does not complain about anything undefined, but will try the sanitize option too. Will also try to isolate it as much as possible.
[Bug c++/67056] Wrong code generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67056 --- Comment #4 from Henning Baldersheim --- Using the -fsanitize-undefined caused this error. configretriever.cpp: info: running test suite 'configretriever.cpp' /home/y/include/c++/5.2.0/bits/unique_ptr.h:76:2: runtime error: execution reached a __builtin_unreachable() call make: *** [test] Error 1 While it works fine when not inlining the constructor.
[Bug ipa/67056] [5/6 regression] Wrong code generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67056 --- Comment #10 from Henning Baldersheim --- Wrong code generation on valid code does sound like a P2 to me.