[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 Nathan Sidwell changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #24 from Nathan Sidwell --- Fixed r254823.
[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 #23 from Nathan Sidwell --- Author: nathan Date: Thu Nov 16 14:54:54 2017 New Revision: 254823 URL: https://gcc.gnu.org/viewcvs?rev=254823=gcc=rev Log: [PATCH] New lang hook https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01340.html PR c++/82836 PR c++/82737 * tree.h (COPY_DECL_RTL): Rename parms for clarity. (SET_DECL_ASSEMBLER_NAME): Forward to overwrite_decl_assembler_name. (COPY_DECL_ASSEMBLER_NAME): Rename parms for clarity. (overwrite_decl_assembler_name): Declare. * tree.c (overwrite_decl_assembler_name): New. * langhooks-def.h (lhd_overwrite_decl_assembler_name): Declare. (LANG_HOOKS_OVERWRITE_DECL_ASSEMBLER_NAME): Provide default. (LANG_HOOKS_INITIALIZER): Add it. * langhooks.h (struct lang_hooks): Add overwrite_decl_assembler_name. * langhooks.c (lhd_set_decl_assembler_name): Use SET_DECL_ASSEMBLER_NAME. (lhd_overwrite_decl_assembler_name): Default implementation. PR c++/82836 PR c++/82737 * cp-objcp-common.h (LANG_HOOKS_OVERWRITE_DECL_ASSEMBLER_NAME): Override. * cp-tree.h (overwrite_mangling): Declare. * decl2.c (struct mangled_decl_hash): Entries are deletable. (overwrite_mangling): New. PR c++/82836 PR c++/82737 * g++.dg/pr82836.C: New. Added: trunk/gcc/testsuite/g++.dg/pr82836.C Modified: trunk/gcc/ChangeLog trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-objcp-common.h trunk/gcc/cp/cp-tree.h trunk/gcc/cp/decl2.c trunk/gcc/langhooks-def.h trunk/gcc/langhooks.c trunk/gcc/langhooks.h trunk/gcc/testsuite/ChangeLog trunk/gcc/tree.c trunk/gcc/tree.h
[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 #22 from Martin Liška --- (In reply to Nathan Sidwell from comment #21) > yeah, I messed up. I had presumed that once set, DECL_ASSEMBLER_NAME does > not change. That is untrue. > In this case it's even worse, in that DECL_ASSEMBLER_NAME is set on a new > decl that duplicate_decl then deletes. This is a latent bug that never > triggered on the old code, but would have left the global namespace pointing > at dead storage. Good, I'm happy you're able to reproduce and to fix that ;)
[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 Nathan Sidwell changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|marxin at gcc dot gnu.org |nathan at gcc dot gnu.org --- Comment #21 from Nathan Sidwell --- yeah, I messed up. I had presumed that once set, DECL_ASSEMBLER_NAME does not change. That is untrue. In this case it's even worse, in that DECL_ASSEMBLER_NAME is set on a new decl that duplicate_decl then deletes. This is a latent bug that never triggered on the old code, but would have left the global namespace pointing at dead storage.
[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 #20 from Martin Liška --- (In reply to Nathan Sidwell from comment #19) > I can take a look at the trunk crash, but not till next week. You could try > https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00384.html, which I've yet to > commit. Don't hurry. However the mentioned patch does not help with this ICE.
[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 #19 from Nathan Sidwell --- I can take a look at the trunk crash, but not till next week. You could try https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00384.html, which I've yet to commit.
[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 #18 from Martin Liška --- Created attachment 42562 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42562=edit Reduce test-case I've got following test-case that started with r253608: $ ./xg++ -B. -std=c++1z -mavx512dq -c /tmp/repro.ii cc1plus: internal compiler error: Segmentation fault 0x1203f31 crash_signal ../../gcc/toplev.c:326 0x1575044 decl_assembler_name(tree_node*) ../../gcc/tree.c:672 0x92d913 hash_table::find_slot_with_hash(tree_node* const&, unsigned int, insert_option) ../../gcc/hash-table.h:892 0x929e90 record_mangling(tree_node*, bool) ../../gcc/cp/decl2.c:4405 0x989780 mangle_decl(tree_node*) ../../gcc/cp/mangle.c:3842 0x1575094 decl_assembler_name(tree_node*) ../../gcc/tree.c:673 0xc7e3ed symtab_node::get_comdat_group_id() ../../gcc/cgraph.h:215 0xc96888 analyze_functions ../../gcc/cgraphunit.c:1081 0xc9bac3 symbol_table::finalize_compilation_unit() ../../gcc/cgraphunit.c:2666 $ ./xgcc -v Using built-in specs. COLLECT_GCC=./xgcc Target: x86_64-w64-mingw32 Configured with: ../configure --enable-languages=c,c++ --disable-multilib --disable-libsanitizer --prefix=/home/marxin/bin/gcc --disable-bootstrap --target=x86_64-w64-mingw32 Thread model: win32 gcc version 8.0.0 20171010 (experimental) (GCC) Which will be probably another problem as you're using GCC 7.2 Nathan can you please take a look?
[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.
[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 #16 from Martin Liška --- Matti: Any progress with the reduction?
[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 #15 from Martin Liška --- (In reply to Matti Bryce from comment #14) > (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. You can basically following in root folder: $ mkdir objdir $ cd objdir $ ../configure --enable-languages=c,c++ --disable-multilib --disable-bootstrap --disable-libsanitizer $ make -j8 $ ./gcc/xg++ -Bgcc [rest_of_options] That should trigger the ICE. > > 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 #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 #13 from Jonathan Wakely --- (In reply to Matti Bryce from comment #0) > My .i file is (far) too big to be uploaded directly Not if you compress it with zip, gzip, bzip2 or something similar. (In reply to Matti Bryce from comment #7) > I've attempted to reduce a test case, but after 2 days of running creduce, > the produced file won't generate the error. Then you're using creduce wrong. Each step needs to verify it still produces the same error.
[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 #12 from Martin Liška --- (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..
[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 #11 from Martin Liška --- Created attachment 42503 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42503=edit Slightly reduced test-case With following test-case, I see ICE with following cross-compiler: ../configure --enable-languages=c,c++ --disable-multilib --disable-libsanitizer --prefix=/home/marxin/bin/gcc --disable-bootstrap --target=x86_64-w64-mingw32 --enable-checking=no $ ./xg++ -B. ice.ii -std=c++1z -mavx512dq -c -O2 -g --param ggc-min-heapsize=0 In file included from C:/msys64/mingw64/include/c++/7.2.0/locale:42:0, from C:/msys64/mingw64/include/c++/7.2.0/iomanip:37, from C:/repos/gassim/src/Control/Manager.cpp:7: C:/msys64/mingw64/include/c++/7.2.0/bits/locale_conv.h:140:5: internal compiler error: Segmentation fault 0xaffb9f crash_signal ../../gcc/toplev.c:326 0x77aeb6 lookup_page_table_entry ../../gcc/ggc-page.c:646 0x77aeb6 ggc_set_mark(void const*) ../../gcc/ggc-page.c:1536 0x6fc0f1 gt_ggc_mx_lang_tree_node(void*) ./gt-cp-tree.h:136 0x6fdc07 gt_ggc_mx_lang_tree_node(void*) ./gt-cp-tree.h:526 0x6351b1 ggc_remove::ggc_mx(tree_node*&) ../../gcc/hash-traits.h:235 0x6351b1 gt_ggc_mx ../../gcc/hash-table.h:1047 0x6351b1 gt_ggc_mx_hash_table_mangled_decl_hash_(void*) ./gt-cp-decl2.h:28 0x8e0ba5 ggc_mark_root_tab ../../gcc/ggc-common.c:77 0x8e0e80 ggc_mark_roots() ../../gcc/ggc-common.c:94 0x77b7c5 ggc_collect() ../../gcc/ggc-page.c:2206 0x6e9304 expand_or_defer_fn_1(tree_node*) ../../gcc/cp/semantics.c:4177 0x6e9378 expand_or_defer_fn(tree_node*) ../../gcc/cp/semantics.c:4236 0x6a2a14 cp_parser_function_definition_after_declarator ../../gcc/cp/parser.c:26756 0x6a3635 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/cp/parser.c:26667 0x6a3635 cp_parser_init_declarator ../../gcc/cp/parser.c:19526 0x6a83ea cp_parser_single_declaration ../../gcc/cp/parser.c:27207 0x6a85ac cp_parser_template_declaration_after_parameters ../../gcc/cp/parser.c:26809 0x6a8b95 cp_parser_explicit_template_declaration ../../gcc/cp/parser.c:27046 0x6a8b95 cp_parser_template_declaration_after_export ../../gcc/cp/parser.c:27065
[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 #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 #8 from Matti Bryce --- Created attachment 42496 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42496=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 #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 #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 Martin Liška changed: What|Removed |Added Keywords||needs-reduction Status|WAITING |NEW Assignee|unassigned at gcc dot gnu.org |marxin at gcc dot gnu.org --- Comment #5 from Martin Liška --- Confirmed with cross compiler, I reduce a test-case.
[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 #4 from Martin Liška --- (In reply to Richard Biener from comment #3) > I can build the preprocessed source when changing the long long size_t and > friend > types to 'long'. But then I cannot reproduce the segfault with -std=c++1z > -g -O2, > it might require MS ABI stuff if it occurs in the dwarf output machinery, > I checked on x86_64-linux. Can you please upload the modified file somewhere? I can try a cross compiler.
[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 #3 from Richard Biener --- I can build the preprocessed source when changing the long long size_t and friend types to 'long'. But then I cannot reproduce the segfault with -std=c++1z -g -O2, it might require MS ABI stuff if it occurs in the dwarf output machinery, I checked on x86_64-linux.
[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 Martin Liška changed: What|Removed |Added Status|UNCONFIRMED |WAITING Last reconfirmed||2017-10-27 CC||marxin at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from Martin Liška --- 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.