Bug 84653 - internal compiler error: Segmentation fault (prep_operand)
Summary: internal compiler error: Segmentation fault (prep_operand)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 8.0.1
: P4 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-checking, ice-on-invalid-code, needs-bisection
Depends on:
Blocks:
 
Reported: 2018-03-01 17:18 UTC by Vegard Nossum
Modified: 2021-12-08 17:40 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-03-01 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vegard Nossum 2018-03-01 17:18:28 UTC
Input:

constexpr int a();
b(int, __attribute__((c(int{} && (a == (auto) (a);)))));

Output:

xgcc -x c++ -S -
<stdin>:2:50: error: expected ')' before ';' token
<stdin>:2:50: internal compiler error: Segmentation fault
0x3155789 crash_signal
        /home/vegard/git/gcc/gcc/toplev.c:325
0x8b8a00 prep_operand
        /home/vegard/git/gcc/gcc/cp/call.c:5404
0x9460d6 build_new_op_1
        /home/vegard/git/gcc/gcc/cp/call.c:5651
0x948c36 build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int)
        /home/vegard/git/gcc/gcc/cp/call.c:6058
0x1395e6b build_x_binary_op(unsigned int, tree_code, tree_node*, tree_code, tree_node*, tree_code, tree_node**, int)
        /home/vegard/git/gcc/gcc/cp/typeck.c:4030
0xec7b2b cp_parser_binary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9354
0xec95aa cp_parser_assignment_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9484
0xed75e4 cp_parser_parenthesized_expression_list
        /home/vegard/git/gcc/gcc/cp/parser.c:7762
0xeda0bb cp_parser_gnu_attribute_list
        /home/vegard/git/gcc/gcc/cp/parser.c:25047
0xeda0bb cp_parser_gnu_attributes_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:24962
0xf8bfc7 cp_parser_decl_specifier_seq
        /home/vegard/git/gcc/gcc/cp/parser.c:13429
0xfbab4d cp_parser_parameter_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:21497
0xfbd49a cp_parser_parameter_declaration_list
        /home/vegard/git/gcc/gcc/cp/parser.c:21309
0xfc0130 cp_parser_parameter_declaration_clause
        /home/vegard/git/gcc/gcc/cp/parser.c:21230
0xf5c19f cp_parser_direct_declarator
        /home/vegard/git/gcc/gcc/cp/parser.c:19983
0xfa24a8 cp_parser_declarator
        /home/vegard/git/gcc/gcc/cp/parser.c:19857
0xfa277e cp_parser_init_declarator
        /home/vegard/git/gcc/gcc/cp/parser.c:19383
0xfa9757 cp_parser_simple_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:13063
0xfaf948 cp_parser_block_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12881
0x1002c05 cp_parser_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12778

$ xgcc --version
xgcc (GCC) 8.0.1 20180301 (experimental)

Built from git c435a9e730c6e8f10da09d58b4fc9aaeb401b0d5 (r258097).

It seems to be present in 4.9.0 if you pass -std=c++14.

Test case was minimised by C-Reduce.
Comment 1 David Malcolm 2018-03-01 20:51:46 UTC
Checked build of trunk segfaults here:

0x0000000000813619 in prep_operand (operand=<eq_expr 0x7ffff19edf28>) at ../../src/gcc/cp/call.c:5404
5404	      if (CLASS_TYPE_P (TREE_TYPE (operand))

where TREE_TYPE (operand) is NULL.

Release builds of 7, 6 (and 5) handle it via the "confused by earlier errors, bailing out" ICE.

Started with r208426
Comment 2 Andrew Pinski 2021-11-28 01:10:12 UTC
This looks like it was fixed in the GCC 8.1.0 release.
Comment 3 Martin Liška 2021-12-08 17:37:02 UTC
Fixed with r8-7465-g91f9108f1bd90c30.