From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2055.outbound.protection.outlook.com [40.107.20.55]) by sourceware.org (Postfix) with ESMTPS id 0FDF7385802D for ; Sat, 5 Dec 2020 18:10:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0FDF7385802D Received: from DB6P193CA0002.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::12) by AM0PR08MB4209.eurprd08.prod.outlook.com (2603:10a6:208:10c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18; Sat, 5 Dec 2020 18:10:27 +0000 Received: from DB5EUR03FT017.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:29:cafe::3f) by DB6P193CA0002.outlook.office365.com (2603:10a6:6:29::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Sat, 5 Dec 2020 18:10:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; 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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT017.mail.protection.outlook.com (10.152.20.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Sat, 5 Dec 2020 18:10:27 +0000 Received: ("Tessian outbound 76bd5a04122f:v71"); Sat, 05 Dec 2020 18:10:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1ef6b2178234eab7 X-CR-MTA-TID: 64aa7808 Received: from b07982954ff0.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A30E7DEF-A16D-4585-A59B-4616BE9FACBD.1; Sat, 05 Dec 2020 18:10:11 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b07982954ff0.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sat, 05 Dec 2020 18:10:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jRkFx2XxrMoER/BdAUDhqq54ImhCGwy8f7JZnG0IYTWJwUnX8wvUf9aZTgCtFreASwYnAY8NxGW/lRdOFfUForcbfxzVT3fGYrZJLLWj0OZ7Dw5KrUfimzzS4O0o+HMGHVavluFE1ZdrKLnb6lZmAwr2qjfCYeUCusX1Izd3anpD9KooHuU2QogACWYfRThrtiYRLEKS+GklIGs5lCBdljZ3DTNpg3Yl0Sb5mm6P552aOsbVXkMO5GmT8279KGGaNWCM0Wko4K8f8vmfF18pqW/ehZktw5HVTrze1/Z/aD0txR8bldLY2GmxBqEzVa8kdOr+oABdPREVAPQexF4Pvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nppa256YJnna6qSx29VT8rJZm6OLs73pOz1lKp3dF0k=; b=WPzjVlORwWGNL9kzhyrDdJeZZ4Lphvu4BJvqU7SZ7nZLBmK+FAay+UDzBvYGhX6TmxYnIptFGEbnOC0skYjlOmywxOivnfqtR1A7+4ipAdFSdaX4jBry5IfjaO34jgw2Gl4N12OXYHdGO5IH5qIK8B+Nd6FdQOEA6aJJ3d1OuIe2S2xD+hR4Opy9A6l9uy0ro9m+Vd3McdIYzf9FkSODg82nz97B4sQnIVHkn6mvded3GZVvIL5dOqXUpLHFkrb05VGj9YSpDZMVHtFIHp1nY7edJPFUQuftHB9n0vB4LOQlYZbgrqGiJQv+mgHGeaIXUX5ypKZ5YBWAn5e8LdxM0Q== 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 Authentication-Results-Original: franke.ms; dkim=none (message not signed) header.d=none;franke.ms; dmarc=none action=none header.from=arm.com; Received: from AM6PR08MB4900.eurprd08.prod.outlook.com (2603:10a6:20b:cc::10) by AS8PR08MB6198.eurprd08.prod.outlook.com (2603:10a6:20b:29f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.19; Sat, 5 Dec 2020 18:10:10 +0000 Received: from AM6PR08MB4900.eurprd08.prod.outlook.com ([fe80::5805:be9:d66d:7b65]) by AM6PR08MB4900.eurprd08.prod.outlook.com ([fe80::5805:be9:d66d:7b65%7]) with mapi id 15.20.3632.019; Sat, 5 Dec 2020 18:10:10 +0000 From: Andrea Corallo To: "Stefan Franke" Cc: , stefan@franke.ms Subject: Re: AW: AW: Correct way to express to the compiler "this does not get clobbered"? References: <32b3c0a3-9917-2b92-de59-1d6a14ecd8f8@hesbynett.no> <20201204172721.GM2672@gate.crashing.org> <20201204183317.GO2672@gate.crashing.org> <017701d6ca6d$7dc8dc90$795a95b0$@bebbosoft.de> <017801d6ca6f$56fed450$04fc7cf0$@bebbosoft.de> <01c901d6cb11$5c31abd0$14950370$@bebbosoft.de> Date: Sat, 05 Dec 2020 19:10:08 +0100 In-Reply-To: <01c901d6cb11$5c31abd0$14950370$@bebbosoft.de> (Stefan Franke's message of "Sat, 5 Dec 2020 15:17:27 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Content-Type: text/plain X-Originating-IP: [217.140.106.37] X-ClientProxiedBy: LO2P265CA0024.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:62::36) To AM6PR08MB4900.eurprd08.prod.outlook.com (2603:10a6:20b:cc::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from e124257 (217.140.106.37) by LO2P265CA0024.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:62::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Sat, 5 Dec 2020 18:10:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3b2b9f8a-97c1-40f8-028e-08d899490b3e X-MS-TrafficTypeDiagnostic: AS8PR08MB6198:|AM0PR08MB4209: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: JQZpitfN43x/n1gU5zuVa3GJXoV4NETMkV+kezLvwvGqxlrx3ukkzEh34TfXBHqI09c23KSik/yyMOhvKWtDheAs3M8kNaeRYu0MHcG7UdFE3yraggNMnIqM6I9+o5qjPB81+SkV6l2yEL6GoCYmEuhAMT8YJK0xzmu7DfWZNaRIQVzJ+ttfOLoMYxTzb+YqKItJUgojmaUBVegN/leWQaFNeT2vZViU3eiEiMwrr/LbTSlZwHiSJG2McPecSul40iVg3X6ALWTXHkutM9hqJxgIBaHvzePu0FCsUyYHpSqh8QBRwgvyhPa2t4MMt+lT8RGdv4CQ3DWZecFszk2Yc5h6vHVhv620RWEF+KVcDEBR9C+ICin17IQTrtkXDoFJ X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB4900.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(39860400002)(376002)(366004)(346002)(6486002)(8936002)(186003)(26005)(316002)(36756003)(4744005)(16526019)(86362001)(5660300002)(66476007)(8676002)(66556008)(956004)(66946007)(2616005)(52116002)(83380400001)(6496006)(4326008)(2906002)(44832011)(6916009)(478600001)(43043002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?EFK7ygtqwXxshck/IF7cf5FNaTejwWxHjIs8Wuc6aAPw4oybKmEk57Jngqvy?= =?us-ascii?Q?mc1eEAr+7LTskJm32VZPjOzNjjKoWgPU3SQ1H8Sb8/6jx0cTHTP2zz2Dvkw7?= =?us-ascii?Q?Ek2Dqul71w5VXI3H7i6oCH6aaPd1vTdrxdKUwD70foTy2VKEOxV9xpvMiaFx?= =?us-ascii?Q?YecpX254vPC10nIR9qgrqK/QoRT/YflNWR12w1hkt7pYNnQz5/H1i9muRWey?= =?us-ascii?Q?3sXWaL4z4Y9zM0krqPvCKA65NsuYJStYEm/v2i/rlkLbS6a0y5nYC9hP0FdN?= =?us-ascii?Q?qwH1xgMi1sxzJFQJh2U1GyKwfVqvrcyZxl4jsaeY81B0mR3wovjqratFArVB?= =?us-ascii?Q?OMNhnq8Dwn3KanY5Ru+Nes0sGIj8faF63tRrOJ+Xei8YyEfKP9BryN0qgvP0?= =?us-ascii?Q?TOt3P6Kyy8btrVdfmVMtlW3YB2er2pC1UzysoMipahQdnlWNZRxm08p2bw8F?= =?us-ascii?Q?hA/64aC56eF+9De4esuTCM5RN07b9WKB0U1SqmhezXro1IAc+DpVWumf0wjC?= =?us-ascii?Q?PodznryMTJN78n8Qjvcl6J8/Xr0uQBINDtj4EB7wpAXbNEqpn1X/Ek5zb4as?= =?us-ascii?Q?GYl5FdOdn8Du40dv6KvdGK1HnUDWMRr1QtC0tLm00BBAF6F8sfAPzZ6NFlW6?= =?us-ascii?Q?7BzUGZJitg0O7PUvwSByKeW9n4mVe+xC67h66vyQo0/DXn4yioZ35GGVKnF3?= =?us-ascii?Q?BMneiISwDQIi6ecyEXqsKezE6Efs8RsFe5r19OntEUivIr6NwVZ+nJv9CyId?= =?us-ascii?Q?nw5qaX9/sBcFj1uU5YaJNuVoeD9x9dxeOvApvGoEpsblqhl43SZJbECXuzIi?= =?us-ascii?Q?h0Ui1OW2/h7y06WbgS66aObcDDqrdXljf7TDneyhwMmDf6jFBt/5zkfanE54?= =?us-ascii?Q?oPnPM4usrmsNLHq074dVC+9iYt1n6BYhFCVlvpm/hjucne8KQ6YmPSf9aFac?= =?us-ascii?Q?21IEWVGOmsduuPubVdv/GKJwDYYWLETYImXu8f5cPMDjrP6McnraFJq/tFtA?= =?us-ascii?Q?7rJ7?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6198 Original-Authentication-Results: franke.ms; dkim=none (message not signed) header.d=none;franke.ms; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT017.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 9d52f7d8-5f7e-48c8-aa73-08d8994900cb X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6Ldclm0w62idBPTDEWZVA3qCFPcHoflP+lSSbxcmaLcTRvi3lecbMUIswSE8La+qgCSAvCyVbW6h7UEtfUcQ+fWfQz0FMeUbjrjGth8SyIZ8ICKKcRvP28UNHCHI2ceO76VZ1MRVoY7hA1aKzeVRJSxF81XNuFGB+7e4eZjlZRatzGfAeTjx7lPF0ILawnzPy8zlKWXIxu+sKieL/ozGnMC2F0ZYn7tHJRbGAKu0Dk6P4U6SUstNw6Jz8AuRmPmR7zNphTF+mXXc1W4qvhwT2PsV9W/ORI2Cyg/8ftl8hPRDZGhSKsTi04GzXZn+mgUO4woYbOwnqewFONQkWIkFgOpz67o+rptjuesl6cyHpdgA0Aa/ceIt7l/A8aEcmueGn1tXb6f85gpSd9fDJBeiMoMIB9h2SVxkJTzKNJXxfh4= 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:(4636009)(376002)(136003)(396003)(346002)(39860400002)(46966005)(5660300002)(4326008)(8676002)(356005)(4744005)(6862004)(47076004)(6496006)(316002)(83380400001)(81166007)(86362001)(8936002)(478600001)(107886003)(26005)(6486002)(70586007)(44832011)(2616005)(70206006)(16526019)(186003)(36756003)(82740400003)(82310400003)(2906002)(336012)(956004)(43043002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2020 18:10:27.3135 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b2b9f8a-97c1-40f8-028e-08d899490b3e 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: DB5EUR03FT017.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4209 X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY 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-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 18:10:30 -0000 "Stefan Franke" writes: [...] > I disagree: > > typedef struct { > void (* const fun_ptr)(void); > const long x; > } x_t; > > Declares that fun_ptr and x both are const and cannot change. So these const value can safely be propagated out of loops if the pointer to is also const and can't change. The current compiler simply ignores that knowledge. > > I cannot judge if this is a bug or a not implemented feature. But in the current implementation only the c/c++ parser cares about const whereas the compiler passes do not check constness. You might be right if you change the code this way, but to begin with how do you set 'fun_ptr' if the only way to access it is through a pointer to const? I suspect this is not very much a realistic case. Andrea