From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 130401 invoked by alias); 21 Mar 2019 10:13:37 -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 130389 invoked by uid 89); 21 Mar 2019 10:13:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1189 X-HELO: foss.arm.com Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Mar 2019 10:13:35 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5DB07374; Thu, 21 Mar 2019 03:13:33 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6AD723F59C; Thu, 21 Mar 2019 03:13:32 -0700 (PDT) From: Richard Sandiford To: Jakub Jelinek Mail-Followup-To: Jakub Jelinek ,"Joseph S. Myers" , Marek Polacek , gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Cc: "Joseph S. Myers" , Marek Polacek , gcc-patches@gcc.gnu.org Subject: Re: [C PATCH] Fix endless loop in the C FE initializer handling (PR c/85704) References: <20180724085756.GB17988@tucnak> Date: Thu, 21 Mar 2019 10:13:00 -0000 In-Reply-To: <20180724085756.GB17988@tucnak> (Jakub Jelinek's message of "Tue, 24 Jul 2018 10:57:56 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-03/txt/msg01039.txt.bz2 [Sorry for responding to such an old patch] Jakub Jelinek writes: > +/* For two FIELD_DECLs in the same chain, return -1 if field1 > + comes before field2, 1 if field1 comes after field2 and > + 0 if field1 == field2. */ > + > +static int > +field_decl_cmp (tree field1, tree field2) > +{ > + if (field1 == field2) > + return 0; > + > + tree bitpos1 = bit_position (field1); > + tree bitpos2 = bit_position (field2); > + if (tree_int_cst_equal (bitpos1, bitpos2)) > + { > + /* If one of the fields has non-zero bitsize, then that > + field must be the last one in a sequence of zero > + sized fields, fields after it will have bigger > + bit_position. */ > + if (TREE_TYPE (field1) != error_mark_node > + && COMPLETE_TYPE_P (TREE_TYPE (field1)) > + && integer_nonzerop (TREE_TYPE (field1))) > + return 1; > + if (TREE_TYPE (field2) != error_mark_node > + && COMPLETE_TYPE_P (TREE_TYPE (field2)) > + && integer_nonzerop (TREE_TYPE (field2))) > + return -1; Looks like these integer_nonzerop should be testing TYPE_SIZE or TYPE_SIZE_UNIT -- not sure which is preferred here. Thanks, Richard