https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82872
Bug ID: 82872 Summary: [6/7/8 Regression] ICE in ignore_overflows on an out-of-bounds index in constexpr Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- The following program causes an ICE. The likely culprit is r180986 committed in the GCC 4.7.0 cycle. $ cat t.C && gcc -S -Wall -Wextra t.C #include <stddef.h> constexpr int f () { struct S { int i, a[1]; }; return offsetof (S, a[__PTRDIFF_MAX__]); } constexpr int i = f (); In file included from t.C:1:0: t.C: In function ‘constexpr int f()’: t.C:7:10: internal compiler error: in ignore_overflows, at cp/cvt.c:583 return offsetof (S, a[__PTRDIFF_MAX__]); ^~~~~~~~ 0x7fb263 ignore_overflows /ssd/src/gcc/git/gcc/cp/cvt.c:583 0x7fbdd1 ocp_convert(tree_node*, tree_node*, int, int, int) /ssd/src/gcc/git/gcc/cp/cvt.c:817 0x7fda55 convert(tree_node*, tree_node*) /ssd/src/gcc/git/gcc/cp/cvt.c:1580 0x9c041e fold_offsetof(tree_node*) /ssd/src/gcc/git/gcc/c-family/c-common.c:6223 0x93d5ee finish_offsetof(tree_node*, tree_node*, unsigned int) /ssd/src/gcc/git/gcc/cp/semantics.c:4038 0x8a0e05 cp_parser_builtin_offsetof /ssd/src/gcc/git/gcc/cp/parser.c:9930 0x897a31 cp_parser_primary_expression /ssd/src/gcc/git/gcc/cp/parser.c:5335 0x89b2ef cp_parser_postfix_expression /ssd/src/gcc/git/gcc/cp/parser.c:7022 0x89e4de cp_parser_unary_expression /ssd/src/gcc/git/gcc/cp/parser.c:8363 0x89f4e8 cp_parser_cast_expression /ssd/src/gcc/git/gcc/cp/parser.c:9131 0x89f5d8 cp_parser_binary_expression /ssd/src/gcc/git/gcc/cp/parser.c:9232 0x8a0204 cp_parser_assignment_expression /ssd/src/gcc/git/gcc/cp/parser.c:9519 0x8a0585 cp_parser_expression /ssd/src/gcc/git/gcc/cp/parser.c:9688 0x8a586a cp_parser_jump_statement /ssd/src/gcc/git/gcc/cp/parser.c:12474 0x8a2959 cp_parser_statement /ssd/src/gcc/git/gcc/cp/parser.c:10897 0x8a3612 cp_parser_statement_seq_opt /ssd/src/gcc/git/gcc/cp/parser.c:11348 0x8a3508 cp_parser_compound_statement /ssd/src/gcc/git/gcc/cp/parser.c:11302 0x8b4a3f cp_parser_function_body /ssd/src/gcc/git/gcc/cp/parser.c:21839 0x8b4b4a cp_parser_ctor_initializer_opt_and_function_body /ssd/src/gcc/git/gcc/cp/parser.c:21874 0x8bc809 cp_parser_function_definition_after_declarator /ssd/src/gcc/git/gcc/cp/parser.c:26765 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.