From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B09BB385783A; Fri, 9 Oct 2020 08:01:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B09BB385783A From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/97347] New: [11 Regression] error: statement marked for throw in middle of block in botan Date: Fri, 09 Oct 2020 08:01:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: ice-on-valid-code 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 keywords 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: Fri, 09 Oct 2020 08:01:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97347 Bug ID: 97347 Summary: [11 Regression] error: statement marked for throw in middle of block in botan Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: rguenth at gcc dot gnu.org Target Milestone: --- The following fails: $ cat botan.ii inline namespace __cxx11 {} typedef int size_t; class MessageAuthenticationCode; class __uniq_ptr_impl { struct _Ptr { using type =3D MessageAuthenticationCode *; }; public: using pointer =3D _Ptr::type; }; class unique_ptr { public: using pointer =3D __uniq_ptr_impl::pointer; unique_ptr(pointer); }; namespace __cxx11 { class basic_string { public: basic_string(char *); ~basic_string(); }; } // namespace __cxx11 class MessageAuthenticationCode {}; class SCAN_Name { public: SCAN_Name(basic_string); size_t arg_as_integer(); }; class SipHash : public MessageAuthenticationCode { public: SipHash(size_t c, size_t d) : m_C(c), m_D(d) {} size_t m_C, m_D; }; void create(basic_string algo_spec) { basic_string provider =3D ""; SCAN_Name req(algo_spec); unique_ptr(new SipHash(req.arg_as_integer(), req.arg_as_integer())); } $ g++ -O3 botan.ii -c -fdump-tree-all botan.ii: In function =E2=80=98void create(__cxx11::basic_string)=E2=80=99: botan.ii:35:27: warning: ISO C++ forbids converting a string constant to =E2=80=98char*=E2=80=99 [-Wwrite-strings] 35 | basic_string provider =3D ""; | ^~ botan.ii:34:6: error: statement marked for throw in middle of block 34 | void create(basic_string algo_spec) { | ^~~~~~ # .MEM_11 =3D VDEF <.MEM_9> _12 =3D operator new (8); during GIMPLE pass: slp dump file: botan.ii.175t.slp2 botan.ii:34:6: internal compiler error: verify_gimple failed 0x1057d5a verify_gimple_in_cfg(function*, bool) /home/marxin/Programming/gcc/gcc/tree-cfg.c:5482 0xf3d36f execute_function_todo /home/marxin/Programming/gcc/gcc/passes.c:1992 0xf3e1bc do_per_function /home/marxin/Programming/gcc/gcc/passes.c:1640 0xf3e1bc execute_todo /home/marxin/Programming/gcc/gcc/passes.c:2046 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions. The insertion code mentions statements that can throw but does not handle i= t. Patch candidate: diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 7e22506b49f..84bc8970f33 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -4148,13 +4148,22 @@ vect_create_constant_vectors (vec_info *vinfo, slp_= tree op_node) gsi =3D gsi_for_stmt (insert_after->stmt); else { - /* When we want to insert after a def where the - defining stmt throws then insert on the fallth= ru - edge. */ edge e =3D find_fallthru_edge (gimple_bb (insert_after->stmt)->succs= ); gcc_assert (single_pred_p (e->dest)); gsi =3D gsi_after_labels (e->dest); + + /* When we want to insert after a def where the + defining stmt throws then insert on the fallth= ru + edge. */ + while (!gsi_end_p (gsi) + && stmt_can_throw_internal (cfun, gsi_stmt (gsi))) + { + e =3D find_fallthru_edge (e->dest->succs); + gcc_assert (single_pred_p (e->dest)); + gsi =3D gsi_after_labels (e->dest); + } + } gsi_insert_seq_after (&gsi, ctor_seq, GSI_CONTINUE_LINKING); What do you think Richi about the patch?=