From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B5E30384B072; Thu, 23 Jun 2022 06:44:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5E30384B072 From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106062] New: [13 Regression] ICE in build_builtin_unreachable since r13-1204-gd68d366425369649 Date: Thu, 23 Jun 2022 06:44:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2022 06:44:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106062 Bug ID: 106062 Summary: [13 Regression] ICE in build_builtin_unreachable since r13-1204-gd68d366425369649 Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: jason at gcc dot gnu.org Target Milestone: --- Since the revision the following fails: $ cat loop.f90 call test (reshape ((/ 'a', 'b', 'c', 'd' /), (/ 2, 2 /))) contains subroutine test (a) character (*), dimension (:, :) :: a if (len (a) .ne. 1) STOP=20 end=20=20 end $ gcc loop.f90 -fsanitize=3Dunreachable -O2 -c during GIMPLE pass: einline loop.f90:1:58: 1 | call test (reshape ((/ 'a', 'b', 'c', 'd' /), (/ 2, 2 /))) | ^ internal compiler error: Segmentation fault 0xfe3e1a crash_signal /home/marxin/Programming/gcc/gcc/toplev.cc:322 0x7ffff78567bf ??? =20=20=20=20=20=20=20 /usr/src/debug/glibc-2.35-4.2.x86_64/signal/../sysdeps/unix/sysv/linux/x86_= 64/libc_sigaction.c:0 0x12d6c45 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) /home/marxin/Programming/gcc/gcc/tree.h:3629 0x12d6c45 build_call_expr_loc_array(unsigned int, tree_node*, int, tree_nod= e**) /home/marxin/Programming/gcc/gcc/tree.cc:10634 0x12d6da0 build_call_expr_loc(unsigned int, tree_node*, int, ...) /home/marxin/Programming/gcc/gcc/tree.cc:10667 0x12d6de8 build_builtin_unreachable(unsigned int) /home/marxin/Programming/gcc/gcc/tree.cc:10819 0xac0aad fold_builtin_0 /home/marxin/Programming/gcc/gcc/builtins.cc:9270 0xac0aad fold_builtin_n /home/marxin/Programming/gcc/gcc/builtins.cc:9578 0xac31a2 fold_call_stmt(gcall*, bool) /home/marxin/Programming/gcc/gcc/builtins.cc:10836 0xcb7c34 gimple_fold_builtin /home/marxin/Programming/gcc/gcc/gimple-fold.cc:5151 0xcb7c34 gimple_fold_call /home/marxin/Programming/gcc/gcc/gimple-fold.cc:5551 0xcba373 fold_stmt_1 /home/marxin/Programming/gcc/gcc/gimple-fold.cc:6295 0x1066af8 fold_marked_statements /home/marxin/Programming/gcc/gcc/tree-inline.cc:5366 0x107afd3 optimize_inline_calls(tree_node*) /home/marxin/Programming/gcc/gcc/tree-inline.cc:5514 0x1e6077f early_inliner(function*) /home/marxin/Programming/gcc/gcc/ipa-inline.cc:3038 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See for instructions. Can be fixed with: gcc/ubsan.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/ubsan.cc b/gcc/ubsan.cc index f15026872a1..b6c4301dfaf 100644 --- a/gcc/ubsan.cc +++ b/gcc/ubsan.cc @@ -654,9 +654,10 @@ sanitize_unreachable_fn (tree *data, location_t loc) } else if (san) { - fn =3D builtin_decl_explicit (BUILT_IN_UBSAN_HANDLE_BUILTIN_UNREACHA= BLE); + /* Call ubsan_create_data first as it initializes SANITIZER built-in= s.=20 */ *data =3D ubsan_create_data ("__ubsan_unreachable_data", 1, &loc, NULL_TREE, NULL_TREE); + fn =3D builtin_decl_explicit (BUILT_IN_UBSAN_HANDLE_BUILTIN_UNREACHA= BLE); *data =3D build_fold_addr_expr_loc (loc, *data); } else=