https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84444
Bug ID: 84444 Summary: ICE with __builtin_launder and cast Product: gcc Version: unknown Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org Target Milestone: --- The following (valid?) code snippet (compiled with "-O") triggers an ICE since GCC 7.1.0: ================================================= struct A {}; __SIZE_TYPE__ foo(A* p) { return (__SIZE_TYPE__)__builtin_launder(p); } ================================================= bug.cc: In function 'long unsigned int foo(A*)': bug.cc:5:44: internal compiler error: Segmentation fault return (__SIZE_TYPE__)__builtin_launder(p); ^ 0xeb0f4f crash_signal ../../gcc/gcc/toplev.c:325 0xa7fc1a builtin_mathfn_code(tree_node const*) ../../gcc/gcc/builtins.c:7840 0xaf0342 convert_to_integer_1 ../../gcc/gcc/convert.c:553 0x8702ef ocp_convert(tree_node*, tree_node*, int, int, int) ../../gcc/gcc/cp/cvt.c:822 0x9e2987 cp_build_c_cast(tree_node*, tree_node*, int) ../../gcc/gcc/cp/typeck.c:7802 0x9e2ada build_c_cast(unsigned int, tree_node*, cp_expr) ../../gcc/gcc/cp/typeck.c:7706 0x911421 cp_parser_cast_expression ../../gcc/gcc/cp/parser.c:9075 0x91198a cp_parser_binary_expression ../../gcc/gcc/cp/parser.c:9187 0x913164 cp_parser_assignment_expression ../../gcc/gcc/cp/parser.c:9476 0x913878 cp_parser_expression ../../gcc/gcc/cp/parser.c:9645 0x91c01b cp_parser_jump_statement ../../gcc/gcc/cp/parser.c:12396 0x91c01b cp_parser_statement ../../gcc/gcc/cp/parser.c:10810 0x91cdc0 cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:11255 0x91ce97 cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:11209 0x933610 cp_parser_function_body ../../gcc/gcc/cp/parser.c:21750 0x933610 cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:21787 0x933ec0 cp_parser_function_definition_after_declarator ../../gcc/gcc/cp/parser.c:26688 0x934bd7 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc/gcc/cp/parser.c:26604 0x934bd7 cp_parser_init_declarator ../../gcc/gcc/cp/parser.c:19476 0x93bc78 cp_parser_simple_declaration ../../gcc/gcc/cp/parser.c:13038 Please submit a full bug report, [etc.]