From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85139 invoked by alias); 20 Dec 2018 19:28:56 -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 85129 invoked by uid 89); 20 Dec 2018 19:28:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=Hx-languages-length:1043 X-HELO: mail-qt1-f170.google.com Received: from mail-qt1-f170.google.com (HELO mail-qt1-f170.google.com) (209.85.160.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Dec 2018 19:28:54 +0000 Received: by mail-qt1-f170.google.com with SMTP id t33so3118584qtt.4 for ; Thu, 20 Dec 2018 11:28:54 -0800 (PST) Return-Path: Received: from [192.168.1.149] (209-6-216-142.s141.c3-0.smr-cbr1.sbo-smr.ma.cable.rcncustomer.com. [209.6.216.142]) by smtp.gmail.com with ESMTPSA id d78sm3456987qke.94.2018.12.20.11.28.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Dec 2018 11:28:51 -0800 (PST) Subject: Re: V9 [PATCH] C/C++: Add -Waddress-of-packed-member To: "H.J. Lu" , Sandra Loosemore Cc: Richard Guenther , "Joseph S. Myers" , Martin Sebor , GCC Patches References: <24f8a201-bb3e-3acb-b679-570a8796358d@redhat.com> <20181218141051.GA3461@gmail.com> <14946d45-0983-12ad-3f93-99da07b3886e@redhat.com> <7f0ae96e-87b8-5db9-97b5-90094c4dace7@redhat.com> From: Jason Merrill Message-ID: <63472b60-a401-5c43-de38-87187cdc95c5@redhat.com> Date: Thu, 20 Dec 2018 19:40:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg01488.txt.bz2 On 12/19/18 12:35 PM, H.J. Lu wrote: > + while (handled_component_p (rhs)) > + { > + if (TREE_CODE (rhs) == COMPONENT_REF) > + break; > + rhs = TREE_OPERAND (rhs, 0); > + } > + > + if (TREE_CODE (rhs) != COMPONENT_REF) > + return NULL_TREE; > + > + object = TREE_OPERAND (rhs, 0); > + field = TREE_OPERAND (rhs, 1); > + > + tree context = check_alignment_of_packed_member (type, field); > + if (context) > + return context; All the above looks unnecessary; it will be handled by the loop below. > + /* Check alignment of the object. */ > + while (handled_component_p (object)) > + { > + if (TREE_CODE (object) == COMPONENT_REF) > + { > + do > + { > + field = TREE_OPERAND (object, 1); > + context = check_alignment_of_packed_member (type, field); > + if (context) > + return context; > + object = TREE_OPERAND (object, 0); > + } > + while (TREE_CODE (object) == COMPONENT_REF); This inner loop also seems unnecessary. > + } > + else > + object = TREE_OPERAND (object, 0); > + } Jason