From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95994 invoked by alias); 29 Sep 2016 14:49:26 -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 95973 invoked by uid 89); 29 Sep 2016 14:49:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=recursion, gathered X-Spam-User: qpsmtpd, 2 recipients X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Sep 2016 14:49:15 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1bpce8-0003LA-6N from Thomas_Schwinge@mentor.com ; Thu, 29 Sep 2016 07:49:12 -0700 Received: from hertz.schwinge.homeip.net (137.202.0.87) by svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Thu, 29 Sep 2016 15:49:09 +0100 From: Thomas Schwinge To: Richard Biener CC: GCC Patches , Joseph Myers , GCC Development , Jakub Jelinek , Bernd Schmidt Subject: Explicitly list all tree codes in gcc/tree-streamer.c:record_common_node (was: [PR lto/77458] Avoid ICE in offloading with differing _FloatN, _FloatNx types) In-Reply-To: References: <20160817154244.GA39270@arm.com> <87h99s53ls.fsf@kepler.schwinge.homeip.net> <87d1kefwgt.fsf@hertz.schwinge.homeip.net> <87twdgb9zi.fsf@hertz.schwinge.homeip.net> <87poo4as2j.fsf@hertz.schwinge.homeip.net> <87bmzkb0h5.fsf@hertz.schwinge.homeip.net> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Thu, 29 Sep 2016 14:55:00 -0000 Message-ID: <87lgya7odk.fsf@hertz.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-SW-Source: 2016-09/txt/msg02256.txt.bz2 Hi Richard! On Mon, 19 Sep 2016 13:25:01 +0200, Richard Biener wrote: > On Mon, Sep 19, 2016 at 1:19 PM, Thomas Schwinge > wrote: > > On Mon, 19 Sep 2016 10:18:35 +0200, Richard Biener wrote: > >> On Fri, Sep 16, 2016 at 3:32 PM, Thomas Schwinge > >> wrote: > >> > --- gcc/tree-streamer.c > >> > +++ gcc/tree-streamer.c > >> > @@ -278,9 +278,23 @@ record_common_node (struct streamer_tree_cache_= d *cache, tree node) > >> > streamer_tree_cache_append (cache, node, cache->nodes.length ()); > >> > > >> > if (POINTER_TYPE_P (node) > >> > - || TREE_CODE (node) =3D=3D COMPLEX_TYPE > >> > || TREE_CODE (node) =3D=3D ARRAY_TYPE) > >> > record_common_node (cache, TREE_TYPE (node)); > >> > + else if (TREE_CODE (node) =3D=3D COMPLEX_TYPE) > >> > [...] > >> > else if (TREE_CODE (node) =3D=3D RECORD_TYPE) > [looks to me we miss handling of vector type components alltogether, > maybe there are no global vector type trees ...] Looks like it, yes. Would a patch like the following be reasonable, which explicitly lists/handles all expected tree codes, or is something like that not feasible? (That's a subset of tree codes I gathered by a partial run of the GCC testsuite, and libgomp testsuite; not claiming this is complete.) commit f28dd9618be8a26c6a75ee089f1755e4e0281106 Author: Thomas Schwinge Date: Thu Sep 29 16:35:19 2016 +0200 Explicitly list all tree codes in gcc/tree-streamer.c:record_common_node --- gcc/tree-streamer.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git gcc/tree-streamer.c gcc/tree-streamer.c index 6ada89a..8567a81 100644 --- gcc/tree-streamer.c +++ gcc/tree-streamer.c @@ -303,17 +303,32 @@ record_common_node (struct streamer_tree_cache_d *cac= he, tree node) in the cache as hash value. */ streamer_tree_cache_append (cache, node, cache->nodes.length ()); =20 - if (POINTER_TYPE_P (node) - || TREE_CODE (node) =3D=3D ARRAY_TYPE) - record_common_node (cache, TREE_TYPE (node)); - else if (TREE_CODE (node) =3D=3D COMPLEX_TYPE) + switch (TREE_CODE (node)) { + case ERROR_MARK: + case FIELD_DECL: + case FIXED_POINT_TYPE: + case IDENTIFIER_NODE: + case INTEGER_CST: + case INTEGER_TYPE: + case POINTER_BOUNDS_TYPE: + case REAL_TYPE: + case TREE_LIST: + case VOID_CST: + case VOID_TYPE: + /* No recursion. */ + break; + case POINTER_TYPE: + case REFERENCE_TYPE: + case ARRAY_TYPE: + record_common_node (cache, TREE_TYPE (node)); + break; + case COMPLEX_TYPE: /* Verify that a complex type's component type (node_type) has been handled already (and we thus don't need to recurse here). */ verify_common_node_recorded (cache, TREE_TYPE (node)); - } - else if (TREE_CODE (node) =3D=3D RECORD_TYPE) - { + break; + case RECORD_TYPE: /* The FIELD_DECLs of structures should be shared, so that every COMPONENT_REF uses the same tree node when referencing a field. Pointer equality between FIELD_DECLs is used by the alias @@ -322,6 +337,9 @@ record_common_node (struct streamer_tree_cache_d *cache= , tree node) nonoverlapping_component_refs_of_decl_p). */ for (tree f =3D TYPE_FIELDS (node); f; f =3D TREE_CHAIN (f)) record_common_node (cache, f); + break; + default: + gcc_unreachable (); } } =20 Gr=C3=BC=C3=9Fe Thomas