From patchwork Fri Aug 9 09:26:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Coplan X-Patchwork-Id: 1970876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=SEDw7m8z; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=SEDw7m8z; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WgJWv513cz1ybS for ; Fri, 9 Aug 2024 19:29:15 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 85340385843B for ; Fri, 9 Aug 2024 09:29:13 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20600.outbound.protection.outlook.com [IPv6:2a01:111:f403:2613::600]) by sourceware.org (Postfix) with ESMTPS id 70288385C6C8 for ; Fri, 9 Aug 2024 09:28:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 70288385C6C8 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 70288385C6C8 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2613::600 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1723195724; cv=pass; b=mP8AC/svnphTwjkPbYf1lq7Rf1j0Qva/Rp9nQSKREJGtBhWuXWwXaxJOLjlAoi5B7CvMAzGrY4WQWYfCzzCWCYVV8YQBItFg/zRB21y+Xd/dDvbQ/kY0A23x8FyFutsBtYGb89j26i8QfHLZeQEVHH/Y2PJf8DFkgzf3AxtVeg4= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1723195724; c=relaxed/simple; bh=Nq9ob3DWHZFD/LSU9kihzgPOXlYd6AtNK5QJIUTa95o=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=vX4ZTITVBrQgEcYC2XQS3tDk7IVZKkoQYJHsPadaQGL9jbO7ifd97RtfwjwJXP1BoS+tyetxl4e+Uun3AfPljE8fR0JrzDHGk0bqvu52Cft6rAA6ftqF6YHYgHmPKLUjEsOR+4coJ1jAJ2Bnl1JO54tEqns2BQuwadS6GmZeNyY= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=eVuqQfGxP7fu1K0S42wrMiUNHkvdu/wKME600wktbtgykqCp2Izy/IgnldMf7OnEksbkDCra/l9WZC3ICtlOgWMlM7Go/0RZgnj3bVUk2OxxJQJzV8ZaREICAoGVQ2CSkuALnKh+e1gMGn+zM74ZZq7X2uJFs98YWfUf4CrQndAqRZaP/bIYa+fh3r7TEwIGjVEtnCuhqMMYqjr6vaJutdQ4DnDpgrlMGiGFVB0QsYSrPEcHiurScmGsdd8j8MdPByb0B6DwzvlJfBpEXeU+vbmZwPkvMjUj00Prww5GK5qetZ/sZRcJ5NOWM7VL0nc9ORXcgSHUR8Lj8wEroy38MA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VXjl1i7+vImORXu9LUlxvl4SBc8qR1v2rI3BVlG71Kc=; b=f9jC1BKJK4qnv81Yln0m3Bz6m5lzLnI9qphItr8qeh3kVfRR6SkYZq172ZX9yOxB1lanFwlcuVE3vQ1SNQCumhk8iAS/F3cxcLKdwh3akR8zJfTGcMERKKhzKtTmHEV+RMtRH+sMam1s/Z9djYOmim3T3dy4vJlTOhtZUXTUdD74ozFQZb1chBvfFuBt8pJVfV6O20C+za0VXQFLfGPTQOZaYbx5v+chnxRfleCfjXe9hndHuQxfEcyJ60v5ln+qYfmSoAAQJgc3wUNdngg5HvgQE+mqKKlZXsumCZScbt5RskbwWMTiN9KNKkZsmdASpjBm/sTNcPbURHWRWEiy2g== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VXjl1i7+vImORXu9LUlxvl4SBc8qR1v2rI3BVlG71Kc=; b=SEDw7m8zd0SGl+JuHFCbKqvCbAmzb2uY9Ww/DeGjPd/kwxX7NtX4EYtPd7kqKX7lBOOvuMMv3BeKYEwn7Ky1ondmwtDSEk6DDlwYQ4iwlbd9rOwK3yaBjh5XnaNY65i/xncTGA7S8Uyx6PL7HI63N79bJiqGhVlAS0Kr6oMZORM= Received: from AS9PR05CA0166.eurprd05.prod.outlook.com (2603:10a6:20b:496::12) by PAVPR08MB9603.eurprd08.prod.outlook.com (2603:10a6:102:31a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.8; Fri, 9 Aug 2024 09:28:37 +0000 Received: from AMS0EPF000001A3.eurprd05.prod.outlook.com (2603:10a6:20b:496:cafe::b5) by AS9PR05CA0166.outlook.office365.com (2603:10a6:20b:496::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.14 via Frontend Transport; Fri, 9 Aug 2024 09:28:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AMS0EPF000001A3.mail.protection.outlook.com (10.167.16.228) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7849.8 via Frontend Transport; Fri, 9 Aug 2024 09:28:37 +0000 Received: ("Tessian outbound e85d9e0fdb55:v365"); Fri, 09 Aug 2024 09:28:37 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9838b078a496cd36 X-CR-MTA-TID: 64aa7808 Received: from Lb42dc7cee478.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7C2F27A0-653F-43F1-9E46-0119FAF75E9E.1; Fri, 09 Aug 2024 09:26:22 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id Lb42dc7cee478.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 09 Aug 2024 09:26:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RfSk4HAclcr5roe+iCTRV62egT2CwzqaNi+awWwGT7jo+ls3q/deSrBI3QngR0mNytWFu2IgWk19xeN2pi1s5lkGiv+tFUEwyWqM6PtKoDXU53Mibx6ADb96sjyLmMwn8yGCw0MGJQXz4jNmTUk40dcz+Do7skDknQGHe2jzR96btIUU1JohMuEKbH6j57Jz0Px3vRkX6xZu/AolMEL59gJCi5foOGR73xOu2I9GOexNoRzN/en6of01B9Fc/eOMMh/De4Q3N1XecMO07uALSv6HIZDbJvjE1T3972vRzDFx7NGCl6yCQw3i05CZAipTTOZg+R0w5XCVOXWM/ax4ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VXjl1i7+vImORXu9LUlxvl4SBc8qR1v2rI3BVlG71Kc=; b=H+sKmHNbLNIdOeINo/oUDxW+hreve0vd8u+rHtMi3NZNkMYn3UCAfIwQVW1PX/LAiQ8Gjvx80Zl2qXl1YnK3EEv+1tugmKero1nRxeW0duKy4dv3baz2OaWfJc5kQbNqu1ZNdS0CrD3JyQWVoWE+DteLkHyB+tVH0JQSiTvcF5uJJC7rC+EjPnNjZC0mKHtYyJ2Ld19YbDccS6RFADw172q6pkLIIgtGd5W3aX8rxODeIKxYRiXqqPByIFUbRQ/oaZFoWGIohFCdgdJUgvwLdh4slGRVKPGgqBb41pqJ0sqgbyccsCjcdXyHkjAVHmzGyORZtTJttAMjhr1Tale/zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VXjl1i7+vImORXu9LUlxvl4SBc8qR1v2rI3BVlG71Kc=; b=SEDw7m8zd0SGl+JuHFCbKqvCbAmzb2uY9Ww/DeGjPd/kwxX7NtX4EYtPd7kqKX7lBOOvuMMv3BeKYEwn7Ky1ondmwtDSEk6DDlwYQ4iwlbd9rOwK3yaBjh5XnaNY65i/xncTGA7S8Uyx6PL7HI63N79bJiqGhVlAS0Kr6oMZORM= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) by PAXPR08MB6351.eurprd08.prod.outlook.com (2603:10a6:102:df::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.8; Fri, 9 Aug 2024 09:26:20 +0000 Received: from PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::9f32:dc2a:5bec:aeac]) by PAWPR08MB8958.eurprd08.prod.outlook.com ([fe80::9f32:dc2a:5bec:aeac%4]) with mapi id 15.20.7875.007; Fri, 9 Aug 2024 09:26:20 +0000 Date: Fri, 9 Aug 2024 10:26:17 +0100 From: Alex Coplan To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Nathan Sidwell Subject: [PATCH 1/5] cp: Ensure ANNOTATE_EXPRs remain outermost expressions in conditions [PR116140] Message-ID: Content-Disposition: inline X-ClientProxiedBy: LO2P265CA0032.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:61::20) To PAWPR08MB8958.eurprd08.prod.outlook.com (2603:10a6:102:33e::15) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAWPR08MB8958:EE_|PAXPR08MB6351:EE_|AMS0EPF000001A3:EE_|PAVPR08MB9603:EE_ X-MS-Office365-Filtering-Correlation-Id: d073cf78-575f-406d-4bd3-08dcb855a5ed x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230040|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info-Original: uQy5pbzbSAmKWmIirocDJDjmGmVFEe2wqUJV3iz2KKVJ049f1TFxGXSbgfkNCnXBR8bTOxEltW+vV6Cf6LODMZ74i+XxejBwWdDAUjkUjuDDejko0euNHoj2v+sjYCwjJn7jbb/LOYRNC5QvvpyhhratlA12okc2+y65Es7CHsFeTxN638Ju4y2x9D5jROfrD44Xtele+eZ2VFfVj5mocesXhaLAnRH7LucqQrovgmxRrtuk6wQ9rI0bgHx80JTUZ5R/lJ2rsN4LxXULPKaPSCYwtdBhox+h2lmFxs7/8zPhEWZWSVz1qMGdN8jRU/jKq1PoRbNBWdSc1OTaydnpzJKEdJmp/qnVQfJaUviBdY6jnaNnx1mAIyWtK0+2lr8YQT27SEsh3Emsm2IBl13/QVzXMOYorcYXK5bibeDrQgW49ONdcLcoTkxs4rsLXg6wP0GFqzC88CUyAXlBH6BlL2sOORx0aILiaTT7WnZ/FPUaQQ097tyetLjQGVRTv9MGmV4Xt89BNf1nPyi3P4rUwyGPR97zEwihnvsHjLZPF2Ts5e6PusU8Y5EWsc1W82GvjJjMKOAt/+LZzANNFEpKHhSAyGtD3BRpGkJBhJ3Y5H1Nwp+1eTOHCIuyCajoFW0PDSVnHUDml+pcXjwbPNjZonwFLDarsvSUYUO5UoPdm0kZZnAFQWfsV+WDlldCI3iIGKp5UlZiuetPwcxyGppPY7dFvxYF2oyzypaCel0LzWgedG923iidrl5uT5+CmPQBK6EjhLxNYzODfhmfdlztHp9CTsWNLEOhcyXiivJoVVn8k2o5w0drsLDqEiRHVHfyf+oPFF9PZSdNPQesHCuYHsfbxOj+l/hwiapWGYrG3crnkXD00OUdG9d6v4T1o5p2DbMkSvc0E9oJoWo1ZTgly/y66uEKhezchN//U0FFGEYN/HJxAAaTCJ6d5kyUSbJ/twCiSy2aS3e4KsXjvBXl3WSVqPyPbw1BIhzooztrIa61Cd1G/UrdkvBkiD517Ck1GZDxwCNzT2AqUhO96ABy9pQa+/CLrfnBs1HuxMWfwc1ASlUtGtiHC23vGIhjxZW9rasICuziF4RyaOqVbpfsYX6T2twq4imob9MZqWLMWz8XvayRAEfr19nbcE2cZyhJPuO7DPFji20cGq2zUZn3240FMzRwlUCGNMDcmWodCKCXT8ArA+YicdJ9Fr0JYF5YyaG7WFwgr807X8ClmmWhkfXjXpjfhQ60QEQ6zkwaLk3+y97mr8jyLG7hlBd0lBi/AeW35dP3nUs9emUJtJln5ZMJgc2Y7O4YQgcE2AwTh8jvuuWc+TCl3aMQxKwae4kloRTuCZxuIKubqchcSfzLNw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAWPR08MB8958.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6351 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:102:33e::15]; domain=PAWPR08MB8958.eurprd08.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS0EPF000001A3.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 28508e66-4914-4555-c47a-08dcb8555432 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|35042699022|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?tK86dJMxKpc4vQDFmQ9/B8OaN77xS6C?= =?utf-8?q?F4sHGKXZdQTJPIWv2DAoc4rMZX4/fp/8+nTCyJ3aLHbkjhb5hR/XJxgEqRf/itz3w?= =?utf-8?q?xKDmUEtooh7yJf9JU2gh9xPsDP4x7LzhJrD1/qC38c5sdzPzy8eI0ia58SfYIMa0+?= =?utf-8?q?Wd0PpPBozYPxgNtmYf77VtVW5oMdP/lPVZg55l+NcaQ6LHYAViAKZ0NLsywIprWBT?= =?utf-8?q?D7Xi6xbtQwxWyT5U+t1eHfWvsEZH+jYoc1Kv8ZhWTxkUkrsUCOH0v1Be5enAMqhxd?= =?utf-8?q?xZ4TCnod9y39iKHhIBVXFqYvEvqUeYTf343IkMM/gP4rJuOP/Rt1JTAkqv3I/Ac7m?= =?utf-8?q?upQo0Xl7qrFiG25dZpwKdD7Ci0yJ9qR2u+OusN4BpTnQhSrgnvMTam6Ee4Wg+hAAB?= =?utf-8?q?d/1x9ghkLro282Aol1HN6FwDelLRKaBOGprNpPQDuilpKdtjh1CfH8dvamBI5fgrJ?= =?utf-8?q?hj7horFGn7apJWBCffa+jxp2IXxUj31QzhpQcLdJeJOenvn+2svZQ0+jsOqT6ICLw?= =?utf-8?q?9P5/B4hRkH8f+AAw/DHp5iSLyx7BzTJDxsP5TgwZg35MZz1rQy3p1/e8AgnrSDsr1?= =?utf-8?q?jxgZDfGhpWcCK4mRgyG2W6whBA9eor0S1YG2D+36B0VSGCkb+bqJ7AGI8aDzUwdtk?= =?utf-8?q?Icj0NoGmjCRHV8NxAYJA6y1RtFELTH43RZ3RpYeiHxJgtRrjT5zXGAreEhu5azdU/?= =?utf-8?q?OSbr8pm2+BpyHdVPrbw9OKG9EKTWd21oO06JK+EdclCuy1+THPPqUyTtF6jkfdCth?= =?utf-8?q?5kgW5Dp2/8KI/vQs1EreKbzU1vRhPmEuidqyiLCU/mAF23q/3PMR/3LqBNnfzt5de?= =?utf-8?q?n1YFx99vX21Nzp6wDZXaQTU18RcmpGDxIP1QDVsXwYl9MraBObFWVYbo8uwFWOAQP?= =?utf-8?q?Br7fPwRagnjmxrdOvoq2fZEm4aJ0s1qXD6Gs+Plpi4XhgduavKRUhNfuPtT/7Ka5I?= =?utf-8?q?cvR/EBo+ky2vO5fcKwFbavolItYWeZySJBCgN9StqA6rBSrnXoaLTePqyRRTmb8GO?= =?utf-8?q?8DbJ5zr6LciwO0K0NUZLjkLCDgVj+ukoxwb4f/2Y1dfpKQXVW6IIRD6gyGnrT2bAD?= =?utf-8?q?Zj+9GFRVu+i9tOqYKZM6xDLHxdNmoVRzZ9QA2+aYGD1qblWkCgMT0pLh77cMgVZOq?= =?utf-8?q?cUt108/9tjRGd/Y83ohkuWVusSmaPLY4PnqCB91x7BAAec3qX96WBH+Wi6VnpL7Sp?= =?utf-8?q?/aAVBxJ2N/3hAvZa2CXr9EEQWFNhbSmOdK8cWXc9RQnD7nOc5Qyvcj0JAKeFksTQP?= =?utf-8?q?93tEeLIyGcwzi8BgBBTGRPLBDdDDvNiCWJAV04cVk+Z5OTF3OLrqiIrWRTVrkBn90?= =?utf-8?q?NQKPE37S8SZYgA7JCzjevLgvE2hioD2ttJ/OGiNeRrbMB6UTPPS6NW1yPtlOnJnA/?= =?utf-8?q?gkfotxWqFuu?= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230040)(36860700013)(1800799024)(35042699022)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2024 09:28:37.4665 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d073cf78-575f-406d-4bd3-08dcb855a5ed X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001A3.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB9603 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org For the testcase added with this patch, we would end up losing the: #pragma GCC unroll 4 and emitting "warning: ignoring loop annotation". That warning comes from tree-cfg.cc:replace_loop_annotate, and means that we failed to process the ANNOTATE_EXPR in tree-cfg.cc:replace_loop_annotate_in_block. That function walks backwards over the GIMPLE in an exiting BB for a loop, skipping over the final gcond, and looks for any ANNOTATE_EXPRS immediately preceding the gcond. The function documents the following pre-condition: /* [...] We assume that the annotations come immediately before the condition in BB, if any. */ now looking at the exiting BB of the loop, we have: : D.4524 = .ANNOTATE (iftmp.1, 1, 4); retval.0 = D.4524; if (retval.0 != 0) goto ; [INV] else goto ; [INV] and crucially there is an intervening assignment between the gcond and the preceding .ANNOTATE ifn call. To see where this comes from, we can look to the IR given by -fdump-tree-original: if (<::operator() (&pred, *first), unroll 4>>>) goto ; else goto ; here the problem is that we've wrapped a CLEANUP_POINT_EXPR around the ANNOTATE_EXPR, meaning the ANNOTATE_EXPR is no longer the outermost expression in the condition. The CLEANUP_POINT_EXPR gets added by the following call chain: finish_while_stmt_cond -> maybe_convert_cond -> condition_conversion -> fold_build_cleanup_point_expr this patch chooses to fix the issue in maybe_convert_cond by walking through any ANNOTATE_EXPRs and doing any condition conversion on the inner expression, leaving the ANNOTATE_EXPRs (if any) as the outermost expressions in the condition. With this patch, we don't get any such warning and the loop gets unrolled as expected at -O2. Bootstrapped/regtested on aarch64-linux-gnu, OK for trunk? gcc/cp/ChangeLog: PR libstdc++/116140 * semantics.cc (maybe_convert_cond): Ensure any ANNOTATE_EXPRs remain the outermost expression(s) of the condition. gcc/testsuite/ChangeLog: PR libstdc++/116140 * g++.dg/ext/pragma-unroll-lambda.C: New test. --- gcc/cp/semantics.cc | 26 ++++++++++++------- .../g++.dg/ext/pragma-unroll-lambda.C | 17 ++++++++++++ 2 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/pragma-unroll-lambda.C diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index e58612660c9..8634a188458 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -966,25 +966,33 @@ maybe_convert_cond (tree cond) if (type_dependent_expression_p (cond)) return cond; + /* If the condition has any ANNOTATE_EXPRs, those must remain the outermost + expressions of the condition. Walk through these, performing the condition + conversion in place on the inner expression. */ + tree *condp = &cond; + while (TREE_CODE (*condp) == ANNOTATE_EXPR) + condp = &TREE_OPERAND (*condp, 0); + /* For structured binding used in condition, the conversion needs to be evaluated before the individual variables are initialized in the std::tuple_{size,elemenet} case. cp_finish_decomp saved the conversion result in a TARGET_EXPR, pick it up from there. */ - if (DECL_DECOMPOSITION_P (cond) - && DECL_DECOMP_IS_BASE (cond) - && DECL_DECOMP_BASE (cond) - && TREE_CODE (DECL_DECOMP_BASE (cond)) == TARGET_EXPR) - cond = TARGET_EXPR_SLOT (DECL_DECOMP_BASE (cond)); + if (DECL_DECOMPOSITION_P (*condp) + && DECL_DECOMP_IS_BASE (*condp) + && DECL_DECOMP_BASE (*condp) + && TREE_CODE (DECL_DECOMP_BASE (*condp)) == TARGET_EXPR) + *condp = TARGET_EXPR_SLOT (DECL_DECOMP_BASE (*condp)); if (warn_sequence_point && !processing_template_decl) - verify_sequence_points (cond); + verify_sequence_points (*condp); - maybe_warn_unparenthesized_assignment (cond, /*nested_p=*/false, + maybe_warn_unparenthesized_assignment (*condp, /*nested_p=*/false, tf_warning_or_error); /* Do the conversion. */ - cond = convert_from_reference (cond); - return condition_conversion (cond); + *condp = convert_from_reference (*condp); + *condp = condition_conversion (*condp); + return cond; } /* Finish an expression-statement, whose EXPRESSION is as indicated. */ diff --git a/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda.C b/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda.C new file mode 100644 index 00000000000..f410f6d8d25 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pragma-unroll-lambda.C @@ -0,0 +1,17 @@ +// { dg-do compile { target c++11 } } + +template +inline Iter +my_find(Iter first, Iter last, Pred pred) +{ +#pragma GCC unroll 4 + while (first != last && !pred(*first)) + ++first; + return first; +} + +short *use_find(short *p) +{ + auto pred = [](short x) { return x == 42; }; + return my_find(p, p + 1024, pred); +}