From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52473 invoked by alias); 16 Oct 2019 13:23:12 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 52462 invoked by uid 89); 16 Oct 2019 13:23:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,SPF_PASS autolearn=ham version=3.3.1 spammy=UD:c.jj, UD:jj, bitsize X-HELO: esa3.mentor.iphmx.com Received: from esa3.mentor.iphmx.com (HELO esa3.mentor.iphmx.com) (68.232.137.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Oct 2019 13:23:10 +0000 IronPort-SDR: sVKYXk0wFZ8BRklowemy5sXMy04GAepeo358vy2Dyrv+jcuTj92WqQ+b9FyAUV4o3z6QZzCWld Ux0gitd4Rz8xUgXWACfo5oy73D2Jv5xAPYfEAm7nUuvx8QZrCA8pYRLbDrAiXZ6MXIzkGQ97GO txZDuTyVZnXmaJpbGYNTO6XpbJ1I/Ngo4wIWc6e8jPm+yPzs4C44NTmqDXLCbBsivnmPfv+BMI Bg2SiQKF9AQEhh8YDuOqsY7O/xXE5h9MaCi5U25MhqWHI8JfYkRrpZT0OvFfd8uSHnBwlIhkD1 KOU= Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 16 Oct 2019 05:23:08 -0800 IronPort-SDR: XVd50Ykv8OtBmrbvYH73788ZvRaeY3FP/DtTgVYszqpAlaUQ/FCoZ2TtdxBZ1nGmZ31a2ub5u1 sfPPd49s4xMz9raAMtS3TmbNFg+8ns6U4wzHQmP+WYduOX3wyPq9ZuTGNn4yVUF5+64KVHMBPC oOFbFKY67UgKr5fR9R0tetWGJqxnChtnFbvUkBECQ23AjLhEIH8GCZoqK40gjjm+Atk4EdDoEl Qzvi0u/tBE6Z+yg6iiNEtLvIYrR8q5fXSaUwIGJ4udqYyqowpeZarWM9gyt+TvDyHW6IyIsRg7 6d8= From: Thomas Schwinge To: Jakub Jelinek CC: , Julian Brown Subject: Re: [gomp4.1] Start of structure element mapping support In-Reply-To: <20150731161610.GF1780@tucnak.redhat.com> References: <20150731161610.GF1780@tucnak.redhat.com> User-Agent: Notmuch/0.29.1+93~g67ed7df (https://notmuchmail.org) Emacs/26.1 (x86_64-pc-linux-gnu) Date: Wed, 16 Oct 2019 13:35:00 -0000 Message-ID: <87wod4x1sj.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-Path: tschwing@mentor.com X-SW-Source: 2019-10/txt/msg01175.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 4138 Hi Jakub! Stumbled over this while reviewing Julian's "Factor out duplicate code in gimplify_scan_omp_clauses": On 2015-07-31T18:16:10+0200, Jakub Jelinek wrote: > This patch is the start of implementation of struct element mapping. Not quite the same, but similar code is still present in GCC trunk. > --- gcc/gimplify.c.jj 2015-07-31 16:55:01.482411392 +0200 > +++ gcc/gimplify.c 2015-07-31 16:57:22.307320290 +0200 > + tree offset; Here we define 'offset'... > + HOST_WIDE_INT bitsize, bitpos; > + machine_mode mode; > + int unsignedp, volatilep =3D 0; > + tree base > + =3D get_inner_reference (OMP_CLAUSE_DECL (c), &bitsize, > + &bitpos, &offset, &mode, &unsignedp, > + &volatilep, false); ..., which here gets writte to... > + gcc_assert (base =3D=3D decl > + && (offset =3D=3D NULL_TREE > + || TREE_CODE (offset) =3D=3D INTEGER_CST)); ..., and here gets checked... > + > + splay_tree_node n > + =3D splay_tree_lookup (ctx->variables, (splay_tree_key)decl); > + if (n =3D=3D NULL || (n->value & GOVD_MAP) =3D=3D 0) > + { > + [...] > + } > + else > + { > + tree *osc =3D struct_map_to_clause->get (decl), *sc; > + if (OMP_CLAUSE_MAP_KIND (c) & GOMP_MAP_FLAG_ALWAYS) > + n->value |=3D GOVD_SEEN; > + offset_int o1, o2; > + if (offset) > + o1 =3D wi::to_offset (offset); ..., and here used. > + else > + o1 =3D 0; > + if (bitpos) > + o1 =3D o1 + bitpos / BITS_PER_UNIT; > + for (sc =3D &OMP_CLAUSE_CHAIN (*osc); *sc !=3D c; > + sc =3D &OMP_CLAUSE_CHAIN (*sc)) > + if (TREE_CODE (OMP_CLAUSE_DECL (*sc)) !=3D COMPONENT_REF) > + break; > + else > + { > + tree offset2; Here we define 'offset2'... > + HOST_WIDE_INT bitsize2, bitpos2; > + base =3D get_inner_reference (OMP_CLAUSE_DECL (*sc), > + &bitsize2, &bitpos2, > + &offset2, &mode, > + &unsignedp, &volatilep, > + false); ..., which here gets writte to... > + if (base !=3D decl) > + break; > + gcc_assert (offset =3D=3D NULL_TREE > + || TREE_CODE (offset) =3D=3D INTEGER_CST); ..., but here we again check 'offset', not 'offset2'... > + tree d1 =3D OMP_CLAUSE_DECL (*sc); > + tree d2 =3D OMP_CLAUSE_DECL (c); > + while (TREE_CODE (d1) =3D=3D COMPONENT_REF) > + if (TREE_CODE (d2) =3D=3D COMPONENT_REF > + && TREE_OPERAND (d1, 1) > + =3D=3D TREE_OPERAND (d2, 1)) > + { > + d1 =3D TREE_OPERAND (d1, 0); > + d2 =3D TREE_OPERAND (d2, 0); > + } > + else > + break; > + if (d1 =3D=3D d2) > + { > + error_at (OMP_CLAUSE_LOCATION (c), > + "%qE appears more than once in map " > + "clauses", OMP_CLAUSE_DECL (c)); > + remove =3D true; > + break; > + } > + if (offset2) > + o2 =3D wi::to_offset (offset2); .., but here again we use 'offset2'. > + else > + o2 =3D 0; > + if (bitpos2) > + o2 =3D o2 + bitpos2 / BITS_PER_UNIT; > + if (wi::ltu_p (o1, o2) > + || (wi::eq_p (o1, o2) && bitpos < bitpos2)) > + break; > + } > + if (!remove) > + OMP_CLAUSE_SIZE (*osc) > + =3D size_binop (PLUS_EXPR, OMP_CLAUSE_SIZE (*osc), > + size_one_node); > + if (!remove && *sc !=3D c) > + { > + *list_p =3D OMP_CLAUSE_CHAIN (c); > + OMP_CLAUSE_CHAIN (c) =3D *sc; > + *sc =3D c; > + continue; > + } > + } > + } > break; > } > flags =3D GOVD_MAP | GOVD_EXPLICIT; Should the second highlighted 'gcc_assert' be changed as follows, suitably adapted for current GCC trunk, of course? (Not yet tested.) If approving such a patch, please respond with "Reviewed-by: NAME " so that your effort will be recorded in the commit log, see . - gcc_assert (offset =3D=3D NULL_TREE - || TREE_CODE (offset) =3D=3D INTEGER_CST); + gcc_assert (offset2 =3D=3D NULL_TREE + || TREE_CODE (offset2) =3D=3D INTEGER_CST); Gr=C3=BC=C3=9Fe Thomas --=-=-= Content-Type: application/pgp-signature; name="signature.asc" Content-length: 658 -----BEGIN PGP SIGNATURE----- iQGyBAEBCgAdFiEEU9WEfWKGQazCmycCAKI7+41Q4XkFAl2nGawACgkQAKI7+41Q 4Xn0aAv4jx1BWikxGT4VQ/Ogu6Pu0LGCX+d4yqZzv7//N8/uGOBDeZ/3Ej8VYoxf FNwZGp3NRTxRPWn+ka4jqwtg9JIfaCD7T5PjG17nzt8AVTE8Amk4Mh4bHbw8lJnH pZ6i5Pq+q7t8J6jqyhd1rbDp7v4qOdkUcQDJaivBJIqCPMBr/yfkP6zvJl6NqVf0 EbUt6KZMMCW63u+yGf4HFcGGQ+zk5h0YOYaShzQtuOikQwSWwcZtwcSNJSJG5+/z KRQ1PvZnSpmJlunVIpKJ2va7FY3ftwHBsGA/Ivm1TjlHd+63GXZMfyAsIcUGgbjh onlsE6kGrbcH1zOcLrhkjQ/OqI2Ulro/sjN+a7yQTCiDuuGUw/LUVlLwCRgUezJe S5zLom5qV+tsAKETR0G6suLVot0Vwnwro7sS3hwnu4KraTl40RlhfkPfPmisceYw prIzmud7iIAlQwEKSbLV6akFkp/2YpXVCZ1gsZ8vzp/UEVRAF6LetT1oc7K+oqW5 VwaNC1s= =YwSg -----END PGP SIGNATURE----- --=-=-=--