[Bug c/67908] New: gcc segfaults with -fstack-check (internal compiler error) / armv7 host and target
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67908 Bug ID: 67908 Summary: gcc segfaults with -fstack-check (internal compiler error) / armv7 host and target Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: gcc-bugs at zahlenfresser dot de Target Milestone: --- Created attachment 36471 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36471&action=edit preprocessed source (part of retroarch) gcc segfaults if a certain source is compiled w/ -fstack-check /usr/bin/gcc -v -save-temps -fstack-check -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wall -O3 -ffast-math -g -std=gnu99 -Wno-unused-result -Wno-unused-variable -c -o test.o test.c gcc: warning: -pipe ignored because -save-temps specified Using built-in specs. COLLECT_GCC=/usr/bin/gcc Target: armv7l-unknown-linux-gnueabihf Configured with: /build/gcc/src/gcc-5.2.0/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues --enable-languages=c,c++,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release --with-default-libstdcxx-abi=gcc4-compatible --host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 Thread model: posix gcc version 5.2.0 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-fstack-check=specific' '-march=armv7-a' '-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-O2' '-pipe' '-fstack-protector' '--param' 'ssp-buffer-size=4' '-Wall' '-O3' '-ffast-math' '-g' '-std=gnu99' '-Wno-unused-result' '-Wno-unused-variable' '-c' '-o' 'test.o' '-mtls-dialect=gnu' /usr/lib/gcc/armv7l-unknown-linux-gnueabihf/5.2.0/cc1 -E -quiet -v test.c -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -mtls-dialect=gnu -std=gnu99 -Wall -Wno-unused-result -Wno-unused-variable -fstack-check=specific -fstack-protector -ffast-math -g -fworking-directory -O2 -O3 -fpch-preprocess -o test.i ignoring nonexistent directory "/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/5.2.0/../../../../armv7l-unknown-linux-gnueabihf/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/armv7l-unknown-linux-gnueabihf/5.2.0/include /usr/local/include /usr/lib/gcc/armv7l-unknown-linux-gnueabihf/5.2.0/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-fstack-check=specific' '-march=armv7-a' '-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-O2' '-pipe' '-fstack-protector' '--param' 'ssp-buffer-size=4' '-Wall' '-O3' '-ffast-math' '-g' '-std=gnu99' '-Wno-unused-result' '-Wno-unused-variable' '-c' '-o' 'test.o' '-mtls-dialect=gnu' /usr/lib/gcc/armv7l-unknown-linux-gnueabihf/5.2.0/cc1 -fpreprocessed test.i -quiet -dumpbase test.c -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -mtls-dialect=gnu -auxbase-strip test.o -g -O2 -O3 -Wall -Wno-unused-result -Wno-unused-variable -std=gnu99 -version -fstack-check=specific -fstack-protector -ffast-math --param ssp-buffer-size=4 -o test.s GNU C99 (GCC) version 5.2.0 (armv7l-unknown-linux-gnueabihf) compiled by GNU C version 5.2.0, GMP version 6.0.0, MPFR version 3.1.3-p4, MPC version 1.0.3 GGC heuristics: --param ggc-min-expand=88 --param ggc-min-heapsize=110029 GNU C99 (GCC) version 5.2.0 (armv7l-unknown-linux-gnueabihf) compiled by GNU C version 5.2.0, GMP version 6.0.0, MPFR version 3.1.3-p4, MPC version 1.0.3 GGC heuristics: --param ggc-min-expand=88 --param ggc-min-heapsize=110029 Compiler executable checksum: a180855a5eef4028f69bbf8deaf89c29 menu/menu_entry.c: In function 'menu_entry_pathdir_get_value': menu/menu_entry.c:243:6: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. If -fstack-check is removed the source compiles. 4.9.3 works with and without -fstack-check with the same source. gcc: gcc
[Bug middle-end/67908] gcc segfaults with -fstack-check (internal compiler error) / armv7 host and target
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67908 --- Comment #2 from Stefan Keller --- The distribution's compiler is built without debug symbols. I need to rebuild, which may take a while. Here's the output of gdb in case it helps anyways: Reading symbols from /usr/lib/gcc/armv7l-unknown-linux-gnueabihf/5.2.0/cc1...(no debugging symbols found)...done. Program received signal SIGSEGV, Segmentation fault. 0x006320b8 in ?? () (gdb) bt #0 0x006320b8 in ?? () #1 0x00697a0c in substitute_and_fold_dom_walker::before_dom_children(basic_block_def*) () #2 0x009c54ec in dom_walker::walk(basic_block_def*) () #3 0x00697438 in substitute_and_fold(tree_node* (*)(tree_node*), bool (*)(gimple_stmt_iterator*), bool) () #4 0x0062971c in ?? () #5 0x00629f48 in ?? () #6 0x004cb2b4 in execute_one_pass(opt_pass*) () #7 0x004cb6ec in ?? () #8 0x004cb704 in ?? () #9 0x004cb744 in execute_pass_list(function*, opt_pass*) () #10 0x00271744 in cgraph_node::expand() () #11 0x00272b7c in ?? () #12 0x00274164 in symbol_table::finalize_compilation_unit() () #13 0x0018391c in c_write_global_declarations() () #14 0x00573900 in ?? () #15 0x0016d380 in toplev::main(int, char**) () #16 0x0016dfac in main ()
[Bug tree-optimization/67908] gcc segfaults with -fstack-check (internal compiler error) / armv7 host and target
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67908 --- Comment #4 from Stefan Keller --- So I rebuilt gcc: GNU C99 (GCC) version 5.2.0 (armv7l-unknown-linux-gnueabihf) compiled by GNU C version 5.2.0, GMP version 6.0.0, MPFR version 3.1.3-p4, MPC version 1.0.3 GGC heuristics: --param ggc-min-expand=88 --param ggc-min-heapsize=110029 GNU C99 (GCC) version 5.2.0 (armv7l-unknown-linux-gnueabihf) compiled by GNU C version 5.2.0, GMP version 6.0.0, MPFR version 3.1.3-p4, MPC version 1.0.3 GGC heuristics: --param ggc-min-expand=88 --param ggc-min-heapsize=110029 Compiler executable checksum: 63e10edc02ccf1dede09ecb3cdb007dd Program received signal SIGSEGV, Segmentation fault. fold_builtin_alloca_with_align (stmt=0x766f0d20) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/tree-ssa-ccp.c:2067 2067&& TREE_CODE (BLOCK_SUPERCONTEXT (block)) == FUNCTION_DECL)) (gdb) bt #0 fold_builtin_alloca_with_align (stmt=0x766f0d20) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/tree-ssa-ccp.c:2067 #1 ccp_fold_stmt (gsi=0x7efff4cc) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/tree-ssa-ccp.c:2172 #2 0x00697a2c in substitute_and_fold_dom_walker::before_dom_children (this=0x7efff538, bb=0x0) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/tree-ssa-propagate.c:1177 #3 0x009c550c in dom_walker::walk (this=0x7efff538, bb=0x766dd940) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/domwalk.c:188 #4 0x00697458 in substitute_and_fold (get_value_fn=get_value_fn@entry=0x62b1c0 , fold_fn=fold_fn@entry=0x631bf4 , do_dce=do_dce@entry=true) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/tree-ssa-propagate.c:1272 #5 0x0062973c in ccp_finalize () at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/tree-ssa-ccp.c:941 #6 0x00629f68 in do_ssa_ccp () at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/tree-ssa-ccp.c:2382 #7 (anonymous namespace)::pass_ccp::execute (this=) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/tree-ssa-ccp.c:2414 #8 0x004cb2d4 in execute_one_pass (pass=pass@entry=0x1053508) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/passes.c:2330 #9 0x004cb70c in execute_pass_list_1 (pass=0x1053508) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/passes.c:2382 #10 0x004cb724 in execute_pass_list_1 (pass=0x1053408, pass@entry=0x1053388) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/passes.c:2383 #11 0x004cb764 in execute_pass_list (fn=0x7669cb60, pass=0x1053388) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/passes.c:2393 #12 0x00271764 in cgraph_node::expand (this=this@entry=0x7669f000) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/cgraphunit.c:1895 #13 0x00272b9c in expand_all_functions () at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/cgraphunit.c:2031 #14 symbol_table::compile (this=this@entry=0x76ad1000) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/cgraphunit.c:2384 #15 0x00274184 in symbol_table::compile (this=0x76ad1000) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/timevar.h:110 #16 symbol_table::finalize_compilation_unit (this=0x76ad1000) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/cgraphunit.c:2461 #17 0x0018393c in c_write_global_declarations () at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/c/c-decl.c:10798 #18 0x00573920 in compile_file () at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/toplev.c:613 #19 0x0016d3a0 in do_compile () at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/toplev.c:2067 #20 toplev::main (this=this@entry=0x7efff8d4, argc=0, argc@entry=27, argv=0x106e6d8, argv@entry=0x7efffa44) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/toplev.c:2165 #21 0x0016dfcc in main (argc=27, argv=0x7efffa44) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/main.c:39 (gdb) p stmt $1 = (gimple) 0x766f0d20 (gdb) p *stmt $2 = {code = GIMPLE_CALL, no_warning = 0, visited = 1, nontemporal_move = 0, plf = 0, modified = 0, has_volatile_ops = 0, pad = 0, subcode = 32, uid = 1, location = 1840891, num_ops = 5, bb = 0x766dd940, next = 0x7682f2f8, prev = 0x767fd900} (gdb) up #1 ccp_fold_stmt (gsi=0x7efff4cc) at /usr/src/misc/pkg/gcc/src/gcc-5.2.0/gcc/tree-ssa-ccp.c:2172 2172tree new_rhs = fold_builtin_alloca_with_align (stmt); (gdb) p gsi $3 = (gimple_stmt_iterator *) 0x7efff4cc (gdb) p *gsi $4 = {ptr = 0x766f0d20, seq = 0x766dd960, bb = 0x766dd940} Hope this helps.