From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 83E533857815 for ; Fri, 1 Jan 2021 00:01:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 83E533857815 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joseph_myers@mentor.com IronPort-SDR: tQA/MNMI8FSuD02anm6dUmWG8dot8p36FZsiSM3e/WNbARSP9Z2Ch9xuhkB/8c1Fo5+Nld36K2 Xs+IP0kkNaREkCDMOQYjA7USccR8PGBqV/LE8ykMwDB7XEzYCZ26yrztMkKSarWx8bBISKBmJE RxvhjJndD/OpJmdJTRtcMYPzO4S3KZ5TDzqf1xkA2Oxeb6v3GWBiXcs7KJzS4fBfby6N4nO7D5 apCi1ftpCVo36G2Ar4A7/312UEhpFcR5Osl7d14EDq/VGCLoiCzacmoX1N+BGl4oD5kBEbg9XG 4NU= X-IronPort-AV: E=Sophos;i="5.78,464,1599552000"; d="scan'208";a="56662248" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 31 Dec 2020 16:01:35 -0800 IronPort-SDR: LCqsFyjR90wGnvau9gDcOXlxh89YRVPH5FbRYAtuyq80GmypLb0uvhgYl/bXppQmSLHAa5PqC/ 6SpahlxYP9JoXOHDW4358Pd+F6CmVJ7t0lgU7sALRO6i2UAH8hcWFWQmz2TbYb48n7/qBAXpwq E+G0wsHWhNMXPwuNaKR8c1skN9nTzlyYTGtIFkYw3Rld3hHGTZm5/GIZjqRo5aY/otC0u9yAQ7 3TX5KHn/SOR8U29exrv8j3D3pN9Qz7F+B00EPtFVgRJP0dmPVGvdly2Ikz3Zt0/ctOoYlmvTCy yH4= Date: Fri, 1 Jan 2021 00:01:29 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: "Uecker, Martin" CC: "gcc-patches@gcc.gnu.org" Subject: Re: [C PATCH] qualifiers of pointers to arrays in C2X [PR 98397] In-Reply-To: <1608546487.5427.1.camel@med.uni-goettingen.de> Message-ID: References: <1608546487.5427.1.camel@med.uni-goettingen.de> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3130.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, 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: Fri, 01 Jan 2021 00:01:39 -0000 On Mon, 21 Dec 2020, Uecker, Martin wrote: > diff --git a/gcc/testsuite/gcc.dg/c2x-qual-1.c b/gcc/testsuite/gcc.dg/c2x-qual-1.c > new file mode 100644 > index 00000000000..058a840e04c > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/c2x-qual-1.c > @@ -0,0 +1,12 @@ > +/* Test that qualifiers are not lost in tertiary operator for pointers to arrays, PR98397 */ > +/* { dg-do compile } */ > +/* { dg-options "-std=gnu2x" } */ > + > +void foo(void) > +{ > + const int (*u)[1]; > + void *v; > + extern const void *vc; > + extern typeof(1 ? u : v) vc; > + extern typeof(1 ? v : u) vc; > +} I'd expect c2x-* tests to use -std=c2x not -std=gnu2x. Tests needing -std=gnu2x can be gnu2x-* tests, but you should be able to test the types using _Generic without needing any gnu2x features. c2x-* tests should also use -pedantic or -pedantic-errors unless they are specifically testing something that doesn't work with those options. There should also be tests for cases where code is valid before C2x but invalid in C2x (assignment storing a pointer-to-qualified-array in void *, for example). All the tests should have both c2x-* and c11-* variants so the testsuite verifies that the code is properly handled in C11 mode (warnings with -pedantic, errors with -pedantic-errors, in the cases that are invalid for C11 but valid for C2x). There should also be -Wc11-c2x-compat tests with -std=c2x where appropriate. -- Joseph S. Myers joseph@codesourcery.com