From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id B86073857033 for ; Wed, 9 Jun 2021 08:47:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B86073857033 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1598ZE2i093736 for ; Wed, 9 Jun 2021 04:47:56 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 392srb1a9c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Jun 2021 04:47:56 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1598ZX7Q095381 for ; Wed, 9 Jun 2021 04:47:56 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 392srb1a8q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Jun 2021 04:47:55 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1598gILa031901; Wed, 9 Jun 2021 08:47:53 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04ams.nl.ibm.com with ESMTP id 3900w8a1d0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Jun 2021 08:47:53 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1598lpea18350432 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Jun 2021 08:47:51 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3945842047; Wed, 9 Jun 2021 08:47:51 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0393E42045; Wed, 9 Jun 2021 08:47:51 +0000 (GMT) Received: from li-926bd7cc-2dd1-11b2-a85c-f6adc0f5efec.ibm.com (unknown [9.171.81.47]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 9 Jun 2021 08:47:50 +0000 (GMT) Subject: Re: [PATCH 1/2] c-family: Copy DECL_USER_ALIGN even if DECL_ALIGN is similar. To: Jason Merrill , Martin Sebor , GCC Patches References: <9c5e0da6-9e62-b3e8-6d65-5fe2999ced1a@gmail.com> <198d8e09-4d03-67a8-d1dc-f1d6ff013581@linux.ibm.com> <3274e729-d0be-5253-a2d4-577dc7d97465@redhat.com> From: Robin Dapp Message-ID: <29dc6cb9-b4f9-c496-04e9-df0d68ae5b9f@linux.ibm.com> Date: Wed, 9 Jun 2021 10:47:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3274e729-d0be-5253-a2d4-577dc7d97465@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: brPQP0NMQT6h2iwXO5rXrnElvIf4aVHY X-Proofpoint-ORIG-GUID: OXRc8TO2Jhv5r5dzx16Uf0iQX68Akiju X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-06-09_04:2021-06-04, 2021-06-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 phishscore=0 spamscore=0 adultscore=0 mlxlogscore=999 clxscore=1015 mlxscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106090037 X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2021 08:47:59 -0000 >>> As you say, the logic is convoluted.  Let's simplify it rather than make >>> it more convoluted.  One possibility would be to change || to | to avoid >>> the shortcut, and then >>> >>> bool note = lastalign > curalign; >>> if (note) >>>     curalign = lastalign; >> >> I went with your suggestion in the attached v2.  Regtested and >> bootstrapped on s390x, x86 and ppc64le. > > OK. urg, I did not commit yet because I fiddled around with my tests again. Using dg-notes checks (and thus being "forced" to handle all cases individually) I realized that the above is not enough as it reintroduces the same problem that I was originally trying to avoid: We want to warn if lastalign == curalign but DECL_USER_ALIGN (last_decl) != DECL_USER_ALIGN (decl), i.e. when the user explicitly specified __attribute__ ((aligned (8))) on s390 (see example in my first mail). What about checking lastalign > curalign || (lastalign == curalign && DECL_USER_ALIGN (last_decl) != DECL_USER_ALIGN (decl)) instead and changing the associated comment? Even then it's not really satisfactory to emit a note that complains about "aligned (8)" at a declaration where it was not even explicitly specified. But then, the situation is similar for other attributes as well and we would need to explicitly store the location where an attribute was specified first. Regards Robin