Bug 1409328 - internal compiler error: Segmentation fault
Summary: internal compiler error: Segmentation fault
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 24
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-31 19:44 UTC by Jeff Layton
Modified: 2017-08-08 19:30 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-08 19:30:50 UTC
Type: Bug


Attachments (Terms of Use)
preprocessed source (7.27 MB, text/x-csrc)
2016-12-31 19:44 UTC, Jeff Layton
no flags Details

Description Jeff Layton 2016-12-31 19:44:24 UTC
Created attachment 1236287 [details]
preprocessed source

Trying to build the ceph source tree (at commit 4e657c7206cd1d36a1ad052e657cc6690be5d1b8), and hit this:

 /home/jlayton/git/ceph/src/test/librbd/exclusive_lock/test_mock_AcquireRequest.cc:363:1: internal compiler error: Segmentation fault
 }
 ^

Preprocessed source stored into /tmp/ccRY37Hl.out file, please attach this to your bugreport.

Comment 1 Jeff Layton 2016-12-31 19:45:08 UTC
Host has:

gcc-6.3.1-1.fc24.x86_64
gcc-c++-6.3.1-1.fc24.x86_64

...let me know if you need other info.

Comment 2 Jeff Layton 2017-01-02 01:34:54 UTC
Downgrading to gcc-6.1.1-2.fc24.x86_64 seems to have worked around it, so this seems like it's probably a recent regression.

Comment 3 Jakub Jelinek 2017-01-02 08:46:05 UTC
Can't reproduce, the attached preprocessed source compiles just fine with gcc-6.3.1-1.fc25 (and the 2 compilers are the same).

Comment 4 Jeff Layton 2017-01-02 11:18:31 UTC
HUh...I can still reproduce it reliably when building ceph and downgrading does fix it. Here it is with the cmake verbosity turned up:

[ 81%] Building CXX object src/test/librbd/CMakeFiles/unittest_librbd.dir/exclusive_lock/test_mock_AcquireRequest.cc.o
cd /home/jlayton/git/ceph/build/src/test/librbd && /usr/bin/c++   -DCEPH_LIBDIR=\"/usr/local/lib64\" -DCEPH_PKGLIBDIR=\"/usr/local/lib64/ceph\" -DTEST_LIBRBD_INTERNALS -D__linux__ -isystem /home/jlayton/git/ceph/build/boost/include -I/home/jlayton/git/ceph/build/src/include -I/home/jlayton/git/ceph/src -isystem /home/jlayton/git/ceph/build/include -I/home/jlayton/git/ceph/src/xxHash -I/home/jlayton/git/ceph/src/googletest/googlemock/include -I/home/jlayton/git/ceph/src/googletest/googletest/include  -Wall -Wtype-limits -Wignored-qualifiers -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char -rdynamic -Wno-unknown-pragmas -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2 -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fdiagnostics-color=auto -I/usr/include/nss3 -I/usr/include/nspr4 -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -O2 -g  -fPIE   -DHAVE_CONFIG_H -D__CEPH__ -D_REENTRANT -D_THREAD_SAFE -D__STDC_FORMAT_MACROS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I/home/jlayton/git/ceph/src/googletest/googlemock/include -I/home/jlayton/git/ceph/build/src/googletest/googlemock/include -I/home/jlayton/git/ceph/src/googletest/googletest/include -I/home/jlayton/git/ceph/build/src/googletest/googletest/include -fno-strict-aliasing -std=c++11 -o CMakeFiles/unittest_librbd.dir/exclusive_lock/test_mock_AcquireRequest.cc.o -c /home/jlayton/git/ceph/src/test/librbd/exclusive_lock/test_mock_AcquireRequest.cc
/home/jlayton/git/ceph/src/test/librbd/exclusive_lock/test_mock_AcquireRequest.cc:363:1: internal compiler error: Segmentation fault
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccc7PVbj.out file, please attach this to your bugreport.

Is there any other info that would help track that down?

Comment 5 Brad Hubbard 2017-01-09 07:19:36 UTC
I can confirm this was happening for me too with gcc-6.3.1-1.fc25.x86_64 and I bisected it down to this commit, although it looks fairly innocuous.

https://github.com/ceph/ceph/commit/66fd36d51fb456140d25cfe7a73b50ff899db6d6

I also have a report of this happening on debian sid with gcc6.

I can no still reproduce this on 66fd36d51fb456140d25cfe7a73b50ff899db6d6 but not on the current master. I'll run another bisect to see if I can work out what "fixed" it when I have time.

Comment 6 Brad Hubbard 2017-01-09 23:11:47 UTC
The commit that "fixed" this issue is https://github.com/ceph/ceph/commit/03533b912c59d5e433d0f006e1a063e014468ca5 No idea why but sure enough this commit compiles whilst the one before it exhibits the ICE.

I drilled down to actually running teh command manually like so.

[brad@rskikr librbd] ((9b430a8...) *$%|BISECTING)$ /usr/lib64/ccache/c++   -DCEPH_LIBDIR=\"/usr/local/lib64\" -DCEPH_PKGLIBDIR=\"/usr/local/lib64/ceph\" -DTEST_LIBRBD_INTERNALS -D__linux__ -isystem /home/brad/working/src/ceph/build/boost/include -I/home/brad/working/src/ceph/build/src/include -I/home/brad/working/src/ceph/src -isystem /home/brad/working/src/ceph/build/include -I/home/brad/working/src/ceph/src/xxHash -I/home/brad/working/src/ceph/src/googletest/googlemock/include -I/home/brad/working/src/ceph/src/googletest/googletest/include  -Wall -Wtype-limits -Wignored-qualifiers -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char -rdynamic -Wno-unknown-pragmas -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2 -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fdiagnostics-color=auto -I/usr/include/nss3 -I/usr/include/nspr4 -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -O2 -g  -fPIE   -DHAVE_CONFIG_H -D__CEPH__ -D_REENTRANT -D_THREAD_SAFE -D__STDC_FORMAT_MACROS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I/home/brad/working/src/ceph/src/googletest/googlemock/include -I/home/brad/working/src/ceph/build/src/googletest/googlemock/include -I/home/brad/working/src/ceph/src/googletest/googletest/include -I/home/brad/working/src/ceph/build/src/googletest/googletest/include -fno-strict-aliasing -std=c++11 -o CMakeFiles/unittest_librbd.dir/exclusive_lock/test_mock_AcquireRequest.cc.o -c /home/brad/working/src/ceph/src/test/librbd/exclusive_lock/test_mock_AcquireRequest.cc && echo $?
/home/brad/working/src/ceph/src/test/librbd/exclusive_lock/test_mock_AcquireRequest.cc:363:1: internal compiler error: Segmentation fault
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/cc6vYBJ0.out file, please attach this to your bugreport.

After some playing around with the flags I got it to compile and all that is required is to remove the "-g" debug build flag.

[brad@rskikr librbd] ((9b430a8...) *$%|BISECTING)$ /usr/lib64/ccache/c++   -DCEPH_LIBDIR=\"/usr/local/lib64\" -DCEPH_PKGLIBDIR=\"/usr/local/lib64/ceph\" -DTEST_LIBRBD_INTERNALS -D__linux__ -isystem /home/brad/working/src/ceph/build/boost/include -I/home/brad/working/src/ceph/build/src/include -I/home/brad/working/src/ceph/src -isystem /home/brad/working/src/ceph/build/include -I/home/brad/working/src/ceph/src/xxHash -I/home/brad/working/src/ceph/src/googletest/googlemock/include -I/home/brad/working/src/ceph/src/googletest/googletest/include  -Wall -Wtype-limits -Wignored-qualifiers -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char -rdynamic -Wno-unknown-pragmas -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2 -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fdiagnostics-color=auto -I/usr/include/nss3 -I/usr/include/nspr4 -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -O2  -fPIE   -DHAVE_CONFIG_H -D__CEPH__ -D_REENTRANT -D_THREAD_SAFE -D__STDC_FORMAT_MACROS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I/home/brad/working/src/ceph/src/googletest/googlemock/include -I/home/brad/working/src/ceph/build/src/googletest/googlemock/include -I/home/brad/working/src/ceph/src/googletest/googletest/include -I/home/brad/working/src/ceph/build/src/googletest/googletest/include -fno-strict-aliasing -std=c++11 -o CMakeFiles/unittest_librbd.dir/exclusive_lock/test_mock_AcquireRequest.cc.o -c /home/brad/working/src/ceph/src/test/librbd/exclusive_lock/test_mock_AcquireRequest.cc && echo $?
0

The only difference between the command that segfaults and the one that does not is the presence of the '-g' flag. 

I don't have the time to pursue this further today but, with a little guidance, I could look into it further in the next few days?

Comment 7 Brad Hubbard 2017-01-10 00:32:32 UTC
Couldn't put this down, as usual...

Here's the stack.

Thread 3.1 "cc1plus" received signal SIGSEGV, Segmentation fault.
[Switching to process 16553]
lookup_page_table_entry (p=0x736c61663c6c616e) at ../../gcc/ggc-page.c:634
634       while (table->high_bits != high_bits)
(gdb) bt
#0  lookup_page_table_entry (p=0x736c61663c6c616e) at ../../gcc/ggc-page.c:634
#1  0x0000000000693f7b in ggc_set_mark (p=p@entry=0x736c61663c6c616e) at ../../gcc/ggc-page.c:1531
#2  0x0000000000e28290 in gt_ggc_mx_lang_tree_node(void*) () at ./gt-cp-tree.h:236
#3  0x00000000006332ef in gt_ggc_mx (x_r=...) at ./gt-cp-semantics.h:53
#4  0x0000000000631ace in gt_ggc_mx<deferred_access_check> (v=<optimized out>) at ../../gcc/vec.h:1076
#5  gt_ggc_mx_vec_deferred_access_check_va_gc_ (x_p=0x7fffc0f92750) at ./gt-cp-semantics.h:45
#6  0x0000000000615d11 in gt_ggc_mx_tree_check (x_p=0x7fffc0f95198) at ./gt-cp-parser.h:151
#7  0x0000000000615cdd in gt_ggc_mx<cp_token> (v=<optimized out>) at ../../gcc/vec.h:1076
#8  gt_ggc_mx_vec_cp_token_va_gc_ (x_p=0x7fffe7819000) at ./gt-cp-parser.h:123
#9  0x0000000000614688 in gt_ggc_mx_cp_lexer (x_p=<optimized out>) at ./gt-cp-parser.h:112
#10 0x0000000000614557 in gt_ggc_mx_cp_parser (x_p=0x7fffe4f0e990) at ./gt-cp-parser.h:45
#11 0x00000000013a8f79 in ggc_mark_root_tab (rt=0x1505ce0 <gt_ggc_r_gt_cp_parser_h>) at ../../gcc/ggc-common.c:77
#12 0x00000000013a8f35 in ggc_mark_roots() () at ../../gcc/ggc-common.c:94
#13 0x0000000000693559 in ggc_collect () at ../../gcc/ggc-page.c:2201
#14 0x0000000000eb55ff in cgraph_node::finalize_function(tree_node*, bool) () at ../../gcc/cgraphunit.c:456
#15 0x0000000000e19c76 in expand_or_defer_fn(tree_node*) () at ../../gcc/cp/semantics.c:4237
#16 0x0000000000df1e2f in cp_parser_function_definition_after_declarator(cp_parser*, bool) () at ../../gcc/cp/parser.c:25441
#17 0x0000000000dde656 in cp_parser_function_definition_from_specifiers_and_declarator (declarator=0x24675a0, attributes=0x0, decl_specifiers=0x7fffffffcd30, parser=0x7fffe4f0e990) at ../../gcc/cp/parser.c:25345
#18 cp_parser_init_declarator(cp_parser*, cp_decl_specifier_seq*, vec<deferred_access_check, va_gc, vl_embed>*, bool, bool, int, bool*, tree_node**, unsigned int*, tree_node**) () at ../../gcc/cp/parser.c:18489
#19 0x0000000000ddc5ec in cp_parser_simple_declaration(cp_parser*, bool, tree_node**) () at ../../gcc/cp/parser.c:12393
#20 0x0000000000ddbde9 in cp_parser_block_declaration(cp_parser*, bool) () at ../../gcc/cp/parser.c:12269
#21 0x0000000000ddb9cd in cp_parser_declaration(cp_parser*) () at ../../gcc/cp/parser.c:12166
#22 0x0000000000ddb728 in cp_parser_declaration_seq_opt (parser=parser@entry=0x7fffe4f0e990) at ../../gcc/cp/parser.c:12045
#23 0x0000000000de9f70 in cp_parser_namespace_body (parser=0x7fffe4f0e990) at ../../gcc/cp/parser.c:17649
#24 cp_parser_namespace_definition(cp_parser*) () at ../../gcc/cp/parser.c:17626
#25 0x0000000000ddb8e8 in cp_parser_declaration(cp_parser*) () at ../../gcc/cp/parser.c:12150
#26 0x0000000000ddb728 in cp_parser_declaration_seq_opt (parser=parser@entry=0x7fffe4f0e990) at ../../gcc/cp/parser.c:12045
#27 0x0000000000de9f70 in cp_parser_namespace_body (parser=0x7fffe4f0e990) at ../../gcc/cp/parser.c:17649
#28 cp_parser_namespace_definition(cp_parser*) () at ../../gcc/cp/parser.c:17626
#29 0x0000000000ddb8e8 in cp_parser_declaration(cp_parser*) () at ../../gcc/cp/parser.c:12150
#30 0x0000000000ddb728 in cp_parser_declaration_seq_opt (parser=parser@entry=0x7fffe4f0e990) at ../../gcc/cp/parser.c:12045
#31 0x0000000001358a75 in cp_parser_translation_unit (parser=0x7fffe4f0e990) at ../../gcc/cp/parser.c:4323
#32 c_parse_file() () at ../../gcc/cp/parser.c:37541
#33 0x0000000001386903 in c_common_parse_file() () at ../../gcc/c-family/c-opts.c:1064
#34 0x00000000013d1218 in compile_file() () at ../../gcc/toplev.c:463
#35 0x0000000000d6c7ba in do_compile () at ../../gcc/toplev.c:1986
#36 toplev::main(int, char**) () at ../../gcc/toplev.c:2094
#37 0x0000000000d6dfb7 in main () at ../../gcc/main.c:39
#38 0x00007ffff6c00401 in __libc_start_main (main=0xd6df80 <main>, argc=84, argv=0x7fffffffd248, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd238) at ../csu/libc-start.c:289
#39 0x000000000134c97a in _start ()

(gdb) p p
$2 = (const void *) 0x736c61663c6c616e

$ echo 0x736c61663c6c616e|xxd -r
slaf<lan

Looks bogus.

So this looks like https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70297 but the fix for that appears to be in gcc-6.3.1-1.fc25.x86_64

Adding "-Q: to the compile command gives more context and I guess the commit that fixed the issue makes more sense I guess, although I'm still clueless.

In file included from /home/brad/working/src/ceph/src/googletest/googletest/include/gtest/gtest.h:58:0,
                 from /home/brad/working/src/ceph/src/test/librbd/test_fixture.h:7,
                 from /home/brad/working/src/ceph/src/test/librbd/test_mock_fixture.h:7,
                 from /home/brad/working/src/ceph/src/test/librbd/exclusive_lock/test_mock_AcquireRequest.cc:4:
/home/brad/working/src/ceph/src/test/librbd/exclusive_lock/test_mock_AcquireRequest.cc: At global scope:
/home/brad/working/src/ceph/src/googletest/googletest/include/gtest/internal/gtest-internal.h:1217:56: internal compiler error: Segmentation fault
   GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
                                                        ^
/home/brad/working/src/ceph/src/googletest/googletest/include/gtest/gtest.h:2217:3: note: in expansion of macro ‘GTEST_TEST_’
   GTEST_TEST_(test_fixture, test_name, test_fixture, \
   ^~~~~~~~~~~
/home/brad/working/src/ceph/src/test/librbd/exclusive_lock/test_mock_AcquireRequest.cc:256:1: note: in expansion of macro ‘TEST_F’
 TEST_F(TestMockExclusiveLockAcquireRequest, Success) {
 ^

Any tips on how to progress this would be appreciated.

Comment 8 Fedora End Of Life 2017-07-26 00:09:05 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 9 Fedora End Of Life 2017-08-08 19:30:50 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.