From patchwork Fri Feb 9 04:02:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 198740 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp616232dyd; Thu, 8 Feb 2024 20:02:53 -0800 (PST) X-Forwarded-Encrypted: i=4; AJvYcCU+Gef7/Tgd+Mlw92bdN1iURvNR2xbaZAFAHBUtjNn3YZFUEtin4yG8Q1OfFcZ4IPMa4hSuNxLhOxM2orJHNgCs6zbwFQ== X-Google-Smtp-Source: AGHT+IHmrTr0QOZ2hwyOho0e71GxusKRouqLDp7AGPGk16eRgDFFdevv9O9M6myZVzXpyw73phgr X-Received: by 2002:a05:622a:1451:b0:42c:3bd5:7fbc with SMTP id v17-20020a05622a145100b0042c3bd57fbcmr652410qtx.52.1707451373155; Thu, 08 Feb 2024 20:02:53 -0800 (PST) ARC-Seal: i=3; a=rsa-sha256; t=1707451373; cv=pass; d=google.com; s=arc-20160816; b=MkTFeCYRolUZfsanRSliDRUTKaqhsI79Bd4nGr+fiZOf3DGSp46QGTb+KNdjxvp03X z6/P/c5s77YCCxLcHeCcy3mkPO40G52SFtMHmfvms12cPNEwH6D5gnXzPWsS+aC7zMof b10yURK9YNwpWuKheeyUakXGL7Yjy8FWwKsKeGBoijRDcwJyihPvNOv/woVBpdAky4fp 4tDSJFrqNdMgzFjek39h0LSBuvHjON6pIoZ2E63BHhSTD+oUWo4KaVlM5urYw70PVF/R 8+tl36bh4s5iDSw49gL6HtOYd6VS5iRwaOTYtLk30KqGwBXV8TdpqDPjpmGoa1Hlpzmc NAyA== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:date:message-id:references :content-transfer-encoding:mime-version:subject:in-reply-to:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=tQLAXAhgCUkkACrIMndaC1vQfbLguRkYvQW7AmN8ulk=; fh=vk1z/99gg+SP//HNV4BxrvCRc9uXnFs0MDFsyz0+p0U=; b=t7v9S6tZ3MgWNRDa+ziLBiskb96KOV44rirFyDnpfQDBHww6rFx/aqJ1LKHvT43JBC slUDDiJPw8/8N7lf/JpGPUbZqM2DvOJBzULrqrMgbVDnt35sNIIzVaxH9gEfF6yHh6aK 2/oNukx9heEd/D+acd3SgjB2JMfyqvhjCgjIdHQEdqBZcdzAakt/Ns1Z2sNDNSIB6+0u iyqXeeapxV/3MtWb6Z3wDCrqFozwWvjhQe9YOFkNuFO1icd8IwYGRayTosh/dPldN9OT w3NIj4K6mkjXtTez0nBSocFw1fvFnqa9D4v0wAhMRSG7TUK9KEn1m+NY0rBQR3mVl4H2 sYjw==; dara=google.com ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@axis.com header.s=selector1 header.b=iRVXENIi; arc=pass (i=2); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com X-Forwarded-Encrypted: i=3; AJvYcCU/LntqOKtSFA2nLmrGJSxhbbjlKhan8ku7ynVi8JL0PG/zPZ8PFYZSQMg/URUaCySWXFm+pMcGhOHFWxn23ud6WEnKNA== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y13-20020a05622a120d00b0042c2baa1d67si1038870qtx.57.2024.02.08.20.02.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 20:02:53 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@axis.com header.s=selector1 header.b=iRVXENIi; arc=pass (i=2); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D234C385841C for ; Fri, 9 Feb 2024 04:02:52 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2080.outbound.protection.outlook.com [40.107.241.80]) by sourceware.org (Postfix) with ESMTPS id DCC5A3858C78 for ; Fri, 9 Feb 2024 04:02:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DCC5A3858C78 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=axis.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DCC5A3858C78 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.241.80 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1707451332; cv=pass; b=QKJAVF3lSpgOie0ijBRJK7TWpB0P9hPvtdvFfMSTPINj7rdd5WSMRGr0ZUZQd5ymYEunjL+sI3JrBAq7kd/xcR3j9pV5jZ3J/h8j9rLB9FJ6ak844O2r3DVlaQq2quqT6VmfPF1Amjlr9GrdLHtWcPo5qwr/PadZ7fR0JCQ8TNw= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1707451332; c=relaxed/simple; bh=RLhuF8HL+LfjqISHfWM2GoDeW7gskSkk2BFH6V65d4A=; h=DKIM-Signature:From:To:Subject:MIME-Version:Message-ID:Date; b=CKoZZo6py6Uk7xSlMnKAUl10yByH3UgST5NIgcHtPDnfaLDBP5iT7TNVRHjeWryiu911DdhpvKxggKmKUJKJgen9qL+N87l+mj7MfdClb1wbdiFYvIQaivytToLRUSWDf2DVYXy1Mn3SQe+7aQ8ootuRq4CkDT7iOaX1B6gARJA= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UrX5u+eAcmI0EU3SD+ruj2b2kX8oB0ILJvJHB4a1M3KgiyGq34PfQ2ebX+H4P/rKs6JCMPMQEop4JOrwTW1ZRiLvj9HEv0tIRjGVH1FFbv8nT2K2T9A5TJ3nMombgnRQT8nPdhw2eMPHS4lmh0YciSKYrCAwLNwNxt93ocyGyrAKQEy+dJ13fA3zVUDR8yBpyuY670+7KCXmhbXe06TPDhFh1nhM5DIxULjIZ/v4CeK0FcmCe1Bv6L8eRQ3t3/pIwdYxg8UakHV5acOntugxnXQAnBVF0LNO3RbbRhlo7uK1ADxO7OcC6Or6Q/Y2FmZWbTm0lijRDm7AivWQo6SN8g== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tQLAXAhgCUkkACrIMndaC1vQfbLguRkYvQW7AmN8ulk=; b=MWedQwQKzC+WaeSHfXyW+gcwRZJ44dFlXqAxAksWpIVr6umZqT9hTAuc5wdz557lDnyJ/LmspAyK1Qy2nvj0ttOMglKZabrMzCeumDzkjBnqC1OIGa93EQPtIgo1Hx+nNk6dzrbGLsTn2BVbMQy0H3ShOIJxIcl3ENP1ViRfCZVtTQd7pMhADfII+AXeh/8kTIrA5/EQURhGpyMXxXvMyKKrFuPyBPI+fMr6ERMS0uay0wTW8KOwokRcM8lRa9+4GoMZaTUfcCYb/omQhuThBdmqRne0SSb0A6PoZELxrYOBl00GSqRcCMgSqTcEoUn6ep6dtCXL0/bZciXuTsWP7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 195.60.68.100) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=axis.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tQLAXAhgCUkkACrIMndaC1vQfbLguRkYvQW7AmN8ulk=; b=iRVXENIingjHbwJbjU6U356Fe+Q/ZTv2MdG6igcf9+ahpnbYVLcZczYgsW3edTpSapYC+b/pNXwxFAzRKCXftbn3cyG/2drF0HfYnPDoGcsiG9XOOIHrALRgNs9ByNzsnj4mw8DyMfWGh4p5recLkPMxlcpbF/FFvdCwfT44ZFo= Received: from AS9PR06CA0453.eurprd06.prod.outlook.com (2603:10a6:20b:49a::7) by AM9PR02MB7075.eurprd02.prod.outlook.com (2603:10a6:20b:271::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.27; Fri, 9 Feb 2024 04:02:05 +0000 Received: from AM2PEPF0001C713.eurprd05.prod.outlook.com (2603:10a6:20b:49a:cafe::94) by AS9PR06CA0453.outlook.office365.com (2603:10a6:20b:49a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.39 via Frontend Transport; Fri, 9 Feb 2024 04:02:05 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=axis.com; Received-SPF: Fail (protection.outlook.com: domain of axis.com does not designate 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; Received: from mail.axis.com (195.60.68.100) by AM2PEPF0001C713.mail.protection.outlook.com (10.167.16.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Fri, 9 Feb 2024 04:02:05 +0000 Received: from se-mail01w.axis.com (10.20.40.7) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 9 Feb 2024 05:02:04 +0100 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Fri, 9 Feb 2024 05:02:04 +0100 Received: from pchp3.se.axis.com (pchp3.se.axis.com [10.88.21.53]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id D88B713E2C; Fri, 9 Feb 2024 05:02:04 +0100 (CET) Received: by pchp3.se.axis.com (Postfix, from userid 171) id CEE3C20419; Fri, 9 Feb 2024 05:02:04 +0100 (CET) From: Hans-Peter Nilsson To: Jason Merrill CC: , In-Reply-To: <3dec1777-c631-4ba7-9e9a-e7b88578c1b0@redhat.com> (message from Jason Merrill on Wed, 7 Feb 2024 16:32:57 -0500) Subject: [PATCH v2]: testcases for "ICE for unknown parameter to constexpr'd switch-statement, PR113545" MIME-Version: 1.0 References: <20240122170232.C836A20439@pchp3.se.axis.com> <20240207002349.54FD220415@pchp3.se.axis.com> <3dec1777-c631-4ba7-9e9a-e7b88578c1b0@redhat.com> Message-ID: <20240209040204.CEE3C20419@pchp3.se.axis.com> Date: Fri, 9 Feb 2024 05:02:04 +0100 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C713:EE_|AM9PR02MB7075:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d75228c-fbcb-466a-79c3-08dc2923e0d9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GgLYyzVRAi0tLTPVdRUVAlXINkYGzZBoMIdrebG4GAHeYfb97VI1vrjPxWVPmlajMI1+12GX4D6ni7Lxi3ruTyd2ZtQ4pjNUyiQTTJ2JmcW2kAn/qKE/2FD8zITXoxOeiF0xJA6/uQAMJnSr5c8cktgfHdj9rStiT6gMFqVaTlcG0PFGbiRoVublGV2oYb1fwhmRJakSygqsI07SVWqK6UQkV2lYD9F+BIgx9pvwtlptwpOlSH43aKBgufnxxQV1OHSY7+M8ynv44awwhL/HR7iPx7o2vRrsfx+889GYmBPTq1kqS2rDfTVvU40bzZhmfITJfzS6kX8xFOv0tD//YER0ITSbdhplfsbqZevl0eiTZ+9J2USQ6IMchBIL+8RGkNpP+GT1+SBnRD7xN8cODzrsl5cw1fKv93pAtrO3NWLuKlNE4eBvIDa/IfOGN5SVPf6kx78xPVu6s0l/UXDN0R1oBhh6GATIqKJy/FBEG602ruGSjYmmh420UB59wu6bRd4jX04gCvYQCYj6Ci6iS6d57iW2OaBoIt7hlpclOUnDooJhRBmMntkXEU8KsU2dIGiYcd3+eMjlZO1JHhAhQhAJgx1PQmQQeOqgcENVGfA= X-Forefront-Antispam-Report: CIP:195.60.68.100; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.axis.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(376002)(136003)(396003)(39860400002)(346002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(82310400011)(46966006)(40470700004)(36840700001)(478600001)(42186006)(316002)(54906003)(2906002)(5660300002)(70206006)(70586007)(6916009)(8676002)(8936002)(4326008)(83380400001)(356005)(336012)(426003)(6266002)(26005)(33656002)(1076003)(41300700001)(81166007)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2024 04:02:05.2398 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d75228c-fbcb-466a-79c3-08dc2923e0d9 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af; Ip=[195.60.68.100]; Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: AM2PEPF0001C713.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR02MB7075 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790392531149811275 X-GMAIL-MSGID: 1790392531149811275 > Date: Wed, 7 Feb 2024 16:32:57 -0500 > From: Jason Merrill > Incidentally, these testcases seem to require C++14; you can't have a > switch in a constexpr function in C++11. Update, v2 (from v1 that had a few requests from Marek resolved from v0 that was posted together with my patch^Whack): Move from cpp0x to cpp1y. Qualify with c++14 instead of c++11. Add a one-liner commit-message. I checked that these DTRT. Currently: Using "make check-gcc-c++ RUNTESTFLAGS=dg.exp=constexpr-reinterpret\*": Running /x/gcc/gcc/testsuite/g++.dg/dg.exp ... === g++ Summary === # of expected passes 33 # of expected failures 3 # of unresolved testcases 3 # of unsupported tests 4 ...and that there's an XPASS when a ICE-resolving patch is applied, testing each of my hack and Jason's, both yield: Using /x/gcc/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /x/gcc/gcc/testsuite/g++.dg/dg.exp ... XPASS: g++.dg/cpp1y/constexpr-reinterpret3.C -std=c++14 (internal compiler error) XPASS: g++.dg/cpp1y/constexpr-reinterpret3.C -std=c++17 (internal compiler error) XPASS: g++.dg/cpp1y/constexpr-reinterpret3.C -std=c++20 (internal compiler error) And (since it appears the benefit isn't obvious) why commit a test-cases before the fix? Well, I'm not dead sure the fix both gets there soon, and that it then stays there. Even if it does so within decent time, as an exception (IIUC) because we're in stage 4 and the bug is not a regression, it could easily be reverted if it'd uncover some other wart that's not sufficiently easily resolved. Also, the fix seems to me sufficiently remote to the gcc_assert, that the execution path leading to it could be diverted; hidden or resolved while fixing something else, and then it'd be nice to know that it fixed *this* bug too. To wit: More dg-ice test-cases! Don't fear adding xfails or dg-ices! Marek, you write that dg-ice support. Thank you! Ok to commit? -- >8 -- gcc/testsuite: Test-cases, with constexpr-reinterpret3.C dg-ice:ing the PR c++/113545 bug. PR c++/113545 * g++.dg/cpp1y/constexpr-reinterpret3.C, g++.dg/cpp1y/constexpr-reinterpret4.C: New tests. --- .../g++.dg/cpp1y/constexpr-reinterpret3.C | 55 +++++++++++++++++++ .../g++.dg/cpp1y/constexpr-reinterpret4.C | 54 ++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret3.C create mode 100644 gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret4.C diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret3.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret3.C new file mode 100644 index 000000000000..ed914383f78b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret3.C @@ -0,0 +1,55 @@ +// PR c++/113545 +// { dg-do run { target c++14 } } +// { dg-ice "PR112545 - constexpr function with switch called for reinterpret_cast" } + +char foo; + +// This one caught a call to gcc_unreachable in +// cp/constexpr.cc:label_matches, when passed a convert_expr from the +// cast in the call. +constexpr unsigned char swbar(__UINTPTR_TYPE__ baz) +{ + switch (baz) + { + case 13: + return 11; + case 14: + return 78; + case 2048: + return 13; + default: + return 42; + } +} + +// For reference, the equivalent* if-statements. +constexpr unsigned char ifbar(__UINTPTR_TYPE__ baz) +{ + if (baz == 13) + return 11; + else if (baz == 14) + return 78; + else if (baz == 2048) + return 13; + else + return 42; +} + +__attribute__ ((__noipa__)) +void xyzzy(int x) +{ + if (x != 42) + __builtin_abort (); +} + +int main() +{ + unsigned const char c = swbar(reinterpret_cast<__UINTPTR_TYPE__>(&foo)); + xyzzy(c); + unsigned const char d = ifbar(reinterpret_cast<__UINTPTR_TYPE__>(&foo)); + xyzzy(d); + unsigned const char e = swbar((__UINTPTR_TYPE__) &foo); + xyzzy(e); + unsigned const char f = ifbar((__UINTPTR_TYPE__) &foo); + xyzzy(f); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret4.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret4.C new file mode 100644 index 000000000000..9aaa6e463bc6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-reinterpret4.C @@ -0,0 +1,54 @@ +// PR c++/113545 +// { dg-do compile { target c++14 } } + +char foo; + +// This one caught a call to gcc_unreachable in +// cp/constexpr.cc:label_matches, when passed a convert_expr from the +// cast in the call. +constexpr unsigned char swbar(__UINTPTR_TYPE__ baz) +{ + switch (baz) + { + case 13: + return 11; + case 14: + return 78; + case 2048: + return 13; + default: + return 42; + } +} + +// For reference, the equivalent* if-statements. +constexpr unsigned char ifbar(__UINTPTR_TYPE__ baz) +{ + if (baz == 13) + return 11; + else if (baz == 14) + return 78; + else if (baz == 2048) + return 13; + else + return 42; +} + +__attribute__ ((__noipa__)) +void xyzzy(int x) +{ + if (x != 42) + __builtin_abort (); +} + +int main() +{ + unsigned constexpr char c = swbar(reinterpret_cast<__UINTPTR_TYPE__>(&foo)); // { dg-error "conversion from pointer type" } + xyzzy(c); + unsigned constexpr char d = ifbar(reinterpret_cast<__UINTPTR_TYPE__>(&foo)); // { dg-error "conversion from pointer type" } + xyzzy(d); + unsigned constexpr char e = swbar((__UINTPTR_TYPE__) &foo); // { dg-error "conversion from pointer type" } + xyzzy(e); + unsigned constexpr char f = ifbar((__UINTPTR_TYPE__) &foo); // { dg-error "conversion from pointer type" } + xyzzy(f); +}