From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1BD51385742E; Wed, 27 Jul 2022 07:10:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1BD51385742E From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/106449] ICE in #pragma omp parallel for simd Date: Wed, 27 Jul 2022 07:10:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-code, openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW 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: 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 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: Wed, 27 Jul 2022 07:10:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106449 --- Comment #2 from Richard Biener --- (In reply to Tobias Burnus from comment #1) > My impression is that the ICE is due to having > fold_build2_loc (0, PLUS_EXPR, type, op0, op1) > with > (gdb) p debug_tree(type) > (gdb) p debug_tree(op0) > constant = 256> > (gdb) p debug_tree(op1) > type =20 > Namely: variable PLUS_EXPR integer_cst - instead of a POINTER_PLUS_EXPR. >=20 >=20 > Patch would be something like the following =E2=80=93 except that there a= re several > additional PLUS_EXPR in that function and that fold_build_pointer_plus > assumes that the first argument is the pointer and the second the offset, > which is converted via convert_to_ptrofftype_loc ... I think the above also shows that op0 is the offset and op1 the base and thus the arguments should be reversed here. > --- a/gcc/omp-expand.cc > +++ b/gcc/omp-expand.cc > @@ -6882 +6882,4 @@ expand_omp_simd (struct omp_region *region, struct > omp_for_data *fd) > - t =3D fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, t2); > + if (POINTER_TYPE_P (TREE_TYPE (t))) > + t =3D fold_build_pointer_plus (t, t2); > + else > + t =3D fold_build2 (PLUS_EXPR, TREE_TYPE (t), t, t2);=