From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DBF923858C2A; Sun, 25 Jun 2023 02:54:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBF923858C2A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687661679; bh=gWvpHVvKVbOjP+iiDqrW7qN2MB+4rOkkkxQtffdyXfI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dCV08YV/8lsJrQDF2nEatpnxgpE4iZjw884WF3BXeBeHRxgE8cTt3VvEsGmR8GMdO M+YpvIJk0tJrkS+zJ63IfqR18MtHPcy3sFLEs/ddy4DoDFVNSTGqYa3uIDsDIuKFq5 8psAZRwKl3b7JE4hmsqMk/bjG1LlmHr3Fv5flb5k= From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110371] [14 Regression] gfortran ICE "verify_gimple failed" in gfortran.dg/vect/pr51058-2.f90 since r14-2007 Date: Sun, 25 Jun 2023 02:54:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code, testsuite-fail X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht at gmail dot com 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: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110371 --- Comment #5 from Hongtao.liu --- Reproduced with typedef struct dest { double m[3][3]; } dest; typedef struct src { int m[3][3]; } src; void foo (dest *a, src* s) { for (int i =3D 0; i !=3D 3; i++) for (int j =3D 0; j !=3D 3; j++) a->m[i][j] =3D s->m[i][j]; } for aarch64-linux-gnu. The problem is when there's more than 1 vop in vec_oprnds0, vec_dest will be overwrited to final vectype_out, but here it's expecting cvt_type. I'm test= ing below: Staged changes 1 file changed, 10 insertions(+), 4 deletions(-) gcc/tree-vect-stmts.cc | 14 ++++++++++---- modified gcc/tree-vect-stmts.cc @@ -5044,7 +5044,7 @@ vectorizable_conversion (vec_info *vinfo, gimple **vec_stmt, slp_tree slp_node, stmt_vector_for_cost *cost_vec) { - tree vec_dest; + tree vec_dest, cvt_op; tree scalar_dest; tree op0, op1 =3D NULL_TREE; loop_vec_info loop_vinfo =3D dyn_cast (vinfo); @@ -5568,6 +5568,13 @@ vectorizable_conversion (vec_info *vinfo, case NONE: vect_get_vec_defs (vinfo, stmt_info, slp_node, ncopies, op0, &vec_oprnds0); + /* vec_dest is intermediate type operand when multi_step_cvt. */ + if (multi_step_cvt) + { + cvt_op =3D vec_dest; + vec_dest =3D vec_dsts[0]; + } + FOR_EACH_VEC_ELT (vec_oprnds0, i, vop0) { /* Arguments are ready, create the new vector stmt. */ @@ -5575,12 +5582,11 @@ vectorizable_conversion (vec_info *vinfo, if (multi_step_cvt) { gcc_assert (multi_step_cvt =3D=3D 1); - new_stmt =3D vect_gimple_build (vec_dest, codecvt1, vop0); - new_temp =3D make_ssa_name (vec_dest, new_stmt); + new_stmt =3D vect_gimple_build (cvt_op, codecvt1, vop0); + new_temp =3D make_ssa_name (cvt_op, new_stmt); gimple_assign_set_lhs (new_stmt, new_temp); vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi= ); vop0 =3D new_temp; - vec_dest =3D vec_dsts[0]; } new_stmt =3D vect_gimple_build (vec_dest, code1, vop0); new_temp =3D make_ssa_name (vec_dest, new_stmt); [back]=