From patchwork Thu Aug 10 15:39:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 134050 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp506296vqi; Thu, 10 Aug 2023 08:40:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG8brPw1ZJ5muqeCArOsLeBNiX16rNYTxWZRMq12j9Fo8lKcqNl7M9ff2V+pu0mES6R60s0 X-Received: by 2002:a2e:9905:0:b0:2b9:48f1:b193 with SMTP id v5-20020a2e9905000000b002b948f1b193mr2004458lji.46.1691682019492; Thu, 10 Aug 2023 08:40:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691682019; cv=none; d=google.com; s=arc-20160816; b=ZHRdF494HI7jWLhk4P6ORYpbZc+/v/4fyfYBRP4PzAad1BRnNfsmJYhmz/OEuMgxkq q9oB+A3UHjoS3Gf558JWk3hHPBnnv7H3nosSW1bLh7A+ZMsz/rQHFUGzntYHEtyIsQ64 8wjW3hRFg8vrOP3MZ+liorr4JDS5dUb9gOq6cGir9iG5PItKCAM9nsIV2sRzvdH2sLr/ QIXb6doEGhOL4Kl+yCbtLYnhInJXktkEoGpZhJaRYXV9PjTs6eDV8QrBoO0GaiGVhFKt VHrodGMWCb/pZOoczZshbG2btWHZQsHHKbc1XliN4wBkmd3MV43rai9vNjsP0iTHt8R1 s/LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=FaYS/5K7QmsNM912ihU/vU+kN292dPwwCxnMVK5uIbE=; fh=aeZHQn/lA9+KGzRlDhL1qO9SE/pAMSdkbwH21Dg0FsA=; b=BtAWszhQVpDfdLP702pBmriF7AeE2NoNWngO7Dir97QDZFDSH5aR9Un8+vPm9WOzCu vI2h2zi771bbQuMuam3UymFfpjDFGUuXz06Glqv1Xy2tfOHh/d5GIVEYwwfER/Bo3Ek6 C1ayq+8xu28XzhvSyRzDj7PrdRPrtqPlB0LW2iVUalPfpoyyNATVWFSo22M51tvQjz48 avhFL2PZ4RrjO/1CHGOKzhG3FZOBqQm3+qw18S5cgMVrssHfba5vF6ZgqmtPlZGjM09r 0ri5Rw9KRZlpyMKX6hTQdlfHDGPCGFi0Tvg/t71RFzXncVK0m38Rp2b+7qa7Ne3nJRJL 9yYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=GSBmYPNw; 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=gnu.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id mf21-20020a170906cb9500b009889713506asi1634699ejb.304.2023.08.10.08.40.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 08:40:19 -0700 (PDT) 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=@gcc.gnu.org header.s=default header.b=GSBmYPNw; 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=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 68A0C3857718 for ; Thu, 10 Aug 2023 15:40:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68A0C3857718 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691682018; bh=FaYS/5K7QmsNM912ihU/vU+kN292dPwwCxnMVK5uIbE=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=GSBmYPNwauDl9YXyBALo1zBORwAp9IHusgt9gx6SmUeIzFADxTs/dawO1Qf/w56AL VZGWzQYZLD7BuW4oSvbswfvNwpAFxDoj69xMMtvwDK+xEV8pXeWyHXdAYEbTIn/bCR 1gFZXqD7bMf79nlyUbQ1n2kSxpNbZ1Ok55OQs0h0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 6C3F63858291 for ; Thu, 10 Aug 2023 15:39:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C3F63858291 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-680-ZtXxrfMlN6id6NcncyFnRg-1; Thu, 10 Aug 2023 11:39:34 -0400 X-MC-Unique: ZtXxrfMlN6id6NcncyFnRg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D35F85CCEC; Thu, 10 Aug 2023 15:39:34 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.225.169]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D77C1492B0F; Thu, 10 Aug 2023 15:39:33 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 37AFdVns2356881 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 10 Aug 2023 17:39:31 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 37AFdUpo2356880; Thu, 10 Aug 2023 17:39:30 +0200 Date: Thu, 10 Aug 2023 17:39:30 +0200 To: "Joseph S. Myers" Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] stdckdint.h _BitInt test Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773857165472968470 X-GMAIL-MSGID: 1773857165472968470 Hi! The following patch (on top of the stdckdint.h patch and _BitInt patch series) adds a test for _BitInt diagnostics of ckd_{add,sub,mul} macros. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2023-08-10 Jakub Jelinek * gcc.dg/stdckdint-3.c: New test. Jakub --- gcc/testsuite/gcc.dg/stdckdint-3.c.jj 2023-08-10 13:02:10.520431079 +0200 +++ gcc/testsuite/gcc.dg/stdckdint-3.c 2023-08-10 13:03:41.352129959 +0200 @@ -0,0 +1,21 @@ +/* Test C23 Checked Integer Arithmetic macros in . */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-std=c2x" } */ + +#include + +int +main () +{ + _BitInt(32) a; + int b; + ckd_add (&a, 1, 1); /* { dg-error "types used in ckd_add should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_sub (&a, 1, 1); /* { dg-error "types used in ckd_sub should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_mul (&a, 1, 1); /* { dg-error "types used in ckd_mul should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_add (&b, 1wb, 1); /* { dg-error "types used in ckd_add should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_sub (&b, 1wb, 1); /* { dg-error "types used in ckd_sub should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_mul (&b, 1wb, 1); /* { dg-error "types used in ckd_mul should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_add (&b, 1, 1wb); /* { dg-error "types used in ckd_add should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_sub (&b, 1, 1wb); /* { dg-error "types used in ckd_sub should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_mul (&b, 1, 1wb); /* { dg-error "types used in ckd_mul should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ +}