From patchwork Fri Apr 19 18:43:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qing Zhao X-Patchwork-Id: 88760 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D3A6338460BD for ; Fri, 19 Apr 2024 18:45:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id B8F44384645B for ; Fri, 19 Apr 2024 18:43:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B8F44384645B Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B8F44384645B Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713552222; cv=pass; b=Wk+xu8Kt+xJrcjPSaCDEG8+nfPbsQa6DnPMfIYjAJd2zCZ8AvWlCVGdQ8L5ObOzHh+9hyC0URleIGHJT+GGHjBH8bhjCIYmuJBSTNIdj3c/hVyDPT8DhrWtoA5x/1kYKvvOxNXcQmtvAfG8Wr6SS+jfSf6jMYkJwGu1+RMmNgA4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713552222; c=relaxed/simple; bh=BIwh20M9N0PmjwEZe+JhtGdl3Qr31OT9zTidbhHWKbM=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-Id: MIME-Version; b=i6tZQ311Ieb5bT3g4n3PF8mVZcAww5z0qfsNkowYOAK2HtVxKPcn3dITa4CN2g0IKNB4K1LgYiLtrsu7yWamoQ4rdSTmgyD0orxEYXUIl+HP2CcPT6/HPTz7TPfbGdQ7EOxADhduyNq6+artjNyY8IEvxhA1SPwTDElyXRqU7cI= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43JINttB021516; Fri, 19 Apr 2024 18:43:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-11-20; bh=GAItpMYjlWt8eFBuTrg22cbArmRBq0Wp4lt4SrOnCQ0=; b=ZtUFZage+Wa7OL5THYMBWwOxeBWsUYTK/1dL9DmrJQZI4IqIwGWZpqqjx3YMOfZ2Ubhe egl9wiuytPaaRA/O3FaDhF2od0ABMolgGQ3jP+8Y4pHRIpqgD2m3TF1OGeA7dhsXoq50 McThDRPFlwwC0FIghfRU/U6PbDfBsBEluyShTu0LVyn61+AMTgc2z1yS9WT5pNzlDZnh 9yIAjFtP+kNE6kj7wntqWq/JjKxNgrAmL+87fhCk00zZVUKn/u7cxm5F7iWfBIPkaLq1 TcQboqB5OE1BwbiscbDttO+iO9uEOuSqoNkOGD/6MuGFNmusaSjiA3GzBdWnZamNlN3X bg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xfhnunjsr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Apr 2024 18:43:37 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43JIPvHx014370; Fri, 19 Apr 2024 18:43:36 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2170.outbound.protection.outlook.com [104.47.58.170]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3xkc97xs1h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Apr 2024 18:43:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dUhBooYtNvjfm/nvIaEmaNEsdYZQUHUjg6JiUYVfbhzusnMWcIQvWSas5KHLcfHA1+5yaVz94sqd27sZZHeEwJHM4fxpPYBVXyE+Sn/hVtlVgYRHtFh8VldyZhdIOuPAgUD67WpxeVOTmNxBozggfJ51K0k3ZJV/9Stzs6YcVegLo2dEqSaKVB12zTV7nkI4FIed0+qvGtD7Bc4MhVooO4gdsgBSwcOAXAv4PGRjW9jSBEIcQZieAOYxpkYYKagEjtZa8ZAS9Zee8cJyQlN/poXlChA6di81zFGetTfZjrftWMnK8dPNFv22II4i5BsexdmrnIs7BU711KLC7MYqFw== 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=GAItpMYjlWt8eFBuTrg22cbArmRBq0Wp4lt4SrOnCQ0=; b=R0aclLaRN87cnB4ojpgHsdX/T5VwsZeNVUzIl5FRXOhX5leu4RUF4FSAScrjAOozI08Y1l/8WendvehTvrQspdwQxifdzP+CqkkM1/o1PFxJsLz8qqWTwhYVdnrP+Qx2GoQbk5vhjRsgMF6y2YjyuP93OQoPCUFa/CfMDhaV5IZz2ATSZCfnnX2uPl8qp9Y/Q8R6aXZQaTSxD14AZx+BczAKAF5iVQ+TBG4AApVN5rRmWtwSdn9hw1/PgEL1CH5JS1bH77PmWrxoMybSueGrgiaD9ZOyC5kTtMEx0plCMkA6qCOdmW2UJizaiNghYqcguXL53slZaIJTRrAofn/k+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GAItpMYjlWt8eFBuTrg22cbArmRBq0Wp4lt4SrOnCQ0=; b=ZfwkaYEE2QV/nxF6AQFpAzl7FF/83QOtOKacmXWhSxYxT+8mARdn3c6riSnORrYQrFsspZhnT1jPOuOsUh/TxK8E8HIcIpLd1/jFuY7oC0zIo+ehcSwFF4fUfMWpuVe95U89CjzVjwQRnDN2I3XgSRKFlhw0AMtQluDm6QHSsEM= Received: from CY8PR10MB6538.namprd10.prod.outlook.com (2603:10b6:930:5a::17) by DM4PR10MB7425.namprd10.prod.outlook.com (2603:10b6:8:180::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.43; Fri, 19 Apr 2024 18:43:34 +0000 Received: from CY8PR10MB6538.namprd10.prod.outlook.com ([fe80::2dae:7852:9563:b4bc]) by CY8PR10MB6538.namprd10.prod.outlook.com ([fe80::2dae:7852:9563:b4bc%6]) with mapi id 15.20.7472.037; Fri, 19 Apr 2024 18:43:34 +0000 From: Qing Zhao To: josmyers@redhat.com, richard.guenther@gmail.com, uecker@tugraz.at Cc: siddhesh@gotplt.org, keescook@chromium.org, gcc-patches@gcc.gnu.org, Qing Zhao Subject: [RFC][PATCH v1 4/4] Adjust testcases for flexible array member in union and alone in structure extension. Date: Fri, 19 Apr 2024 18:43:17 +0000 Message-Id: <20240419184317.2138890-5-qing.zhao@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240419184317.2138890-1-qing.zhao@oracle.com> References: <20240419184317.2138890-1-qing.zhao@oracle.com> X-ClientProxiedBy: MN2PR07CA0025.namprd07.prod.outlook.com (2603:10b6:208:1a0::35) To CY8PR10MB6538.namprd10.prod.outlook.com (2603:10b6:930:5a::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB6538:EE_|DM4PR10MB7425:EE_ X-MS-Office365-Filtering-Correlation-Id: 29945983-9d18-4a4f-8608-08dc60a09ddc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sEMec1KVA+OIIFr3/uECBzeGXfG9vi69gnSXez+KGW+Q0h78T6KH/waWq3cchUHHYjTE2ug5EOzuprh8vwRf5ggA65a6jdi9kIw9TYKiISBxAUTS7RsIk0G/RFoNW8G7cNwsEph6dz9s/jiinmo3ObvcyDy8LGM+ViQrQndEqB2RyDv63ZQZKwnxnvmvRXq+IBBLZucb/k3C6H3KKBZyDnjvmnukunh8083L0wpgsRon4jmzfUpXBEjKpxebdBVMb7mS1o6z4krqdY2gKTYT0rTTbz6xNRyyAgE3QwgjVUIqQwUhn72zZ2q2ffw16RT24ECMPC8DBOROarhJNQck8ohnSgZDbp561aeuM3SkC9qKIfyZD+rc3FRgVn6xXSa7y6KRBPf2Z/H90k1MJq1BfVB5sfMJeAU58QDf1mdVppmyTmIi4R2qVklT8YrKn70Pdvk9GbEatOEmjSwgmWlkSyIqxZKgT029FHXQyR8II6+sHTZZnplA0NlIe4LatqfJc/buDOquOlY3/NQ4QDnKvcYuYUYCyPyab1jtLOZ269TgC9jRRYrjQ7qvB7fgqV3EcvBgGzOquBW136CakVW1jQ7/3dGessmOBGhmcgwWMx/B4xvVv2RrLWOvJqNMwenJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB6538.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366007)(1800799015)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DasZT7lBOLEMh9Y5Tu6VUDOlCzvKsZJ+MN1u5nCt2QC4JrLYCZ+/x3jV6IZRrbZw/oBW1taJGE4RiDxYJw1IAVOVPHJg/EllD0fYtLwv7yVsjohWGl/xJPGUdtI5a7ASFZeP8ALpCR9d41YbZU/b4fcyECi8szJL3qgI9F4mDf7BQH5vZMlFCxInj0iNWMT/lbBDa2WPyn0WeG9s15CFKFKlfrQYHeG/i/sjWQZ8O0XRYUnOhgIK9kc4wqU3mznjzv3NowV/PbWcGGAFpilRarENN035b8K1p0r39RgRi0fxIufGgopRY6suEv6pmPuOiLnPXR1pE+/90AAnZWuC05JLFuMxBJH3yIp8dbhQSQ3EhDvRDgf2mOTL2IIPcswrsZ66Aa8z+vWUch2m2zHk7G2urL2kw4cKoLvVk/fj4JgW5m6TQbmXIDpJNjfm8+EJWTCKNWXsNJzWRyVEIWo89ayXUIgtmj8tqxb9zzsvlKa5nGPjo3LB3n9LUwADu0SDawFQeE0t5dOHg3K8aKPnsIN9bZuHAF3xyBZy8ywdKslSI7ngToIutKU3Z/e6uX3TWJH7MmRjkUKylRP10pU+lWw7RQ3P/baFTaQ+riDqEJ9WBEKNWOhnoh5A7aaF1dZjg26oXWXBmrmnrVuF46eRGFkLD0qw/2CeW/1dmFw7GsjEaGzt+Y4/LbXy8Hq82l/lDsh+fQURfjtmDa3U583MzIW+RXe9F5elIyY4VhKQMQx2qar9tLnrkijbJ4F+0zGaGosWbBh8eEmdqIzJ4t53kyTRFZhH/UeOZpk/aHPFPpE7gjXb6o3PWVQjpewQZZKurSHnj7FLSWIvku+smlceWl2ZQIwCaSWrBNlRDKzZzdWtgsfFcL3yx5b9Pw43QJGxMXd+tDYai5IYRY8OYo2BQVUEfGCyZl3/12AHBwq8J4tADsOVyNxVLzfi/2uh5qpGL9vBQmWyn5rnnJx9MlpyLCEiy6ZlCX/GtD7T53culisZDXXSor6KvbziJHJqH815N8zwIx552ndo9llqgmZYyVQ9I7Mlka0qCdrXcYdfaublfb8VdqDtBgWrdRSboNi+AG84xfqw+1gUDN54NHN80L+uhV60pA5LAxFY88Cvwg5NZCvwV9e6tm2ROi2xI1U2s5v7rdgYPFFIEHRr+qcGR8yGuVpjFBxB63NV7HEsHIjP8Rk5uLdWuHH/f3yJ7esG363UvqmKd+avLfatKfpGT1Yl2AE7XIrzrR2toVBKksEMemy46cHal+qkWGTkrL6YvUVrzXeVUVUK8AkcXwQXmFfEnC6Uafwy55Z7ALCFKO/kvCythfTHOqSCyrpNux4LDyzbZZrs7fJkh9r5vN6ja8SZnEDzm9hbUZ5HQf2vRB7e+SFdIeeV/I8d7pQgjBv2VMOIPt2K9AhSeJLDqA1jymvwZEwENUc4/oMCvBA1SUv+tumUECWrCTkvDpb+6WXQjooJj6t5vu1otL6xmlhbbTuFBM67TPHL2Qc3JrUZJKDwYiRpGAMXwRVvBaX2NdN2wBJm7wA2ITgvJkKXJEg7Gzu4c2bXGvKw2AugxlFMtq5XAzmAwdOXudcRxKmCgIum X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0L6y2gYIjJXnpJuXf28em7AoMEriWm/VHIjnRGUNOLDDaXtSJb3FRCASdZm+i79Tk1X1N+vkvh3vbDY1a0ZW/ZT72EC5CmMtm3qGyWSLomcbquu6yzFWV/48enMkvkvBykSfYDSl2e2oekM6efgX8cOV+UUZZc+YcNLklqHD+cDqMELqGU2ZUE32S5UFw0biszIlr2FUhAUWYpTfCUr0dF3AX9Jv5BLqUbglcbKsfJBLsbNHa9pJ65k5nVMMR1km3ht9mkogdyHGP5E6OVub7lrpJbJqBQjutuUNDrhhY3pDD+2G2fBOW/GIJwybI+DZ21by6gBPXvIiht2ouAnrsKJUN6Q0tWr67YkAepXtc8UcTwFphYQ1hstXC0L2gu76uKnpVOVH9TS+KqJN5+7qRbFd6zH3W132NF9QDg2kXSBfp8K77ZP461aU9wP8blMA7BAqbJkDy2HJzeT1WrlgcZiMunQxLRpQk7T/1pcQupdtiAgDOIe6NOto/EttEPwt4vBi6SvdYoBA0RoHpMhB3VazAYO/iOn4Q43gdYnlYeDYfczsSf+isqDKxa7/VpOuO6l8KLfp9c1POMpz69v+rLyPrIqQANWeA4B9dFceJ3w= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 29945983-9d18-4a4f-8608-08dc60a09ddc X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB6538.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2024 18:43:34.0030 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: c3764Lp7pps/y3eZODYKFd6/J9uuBdVakWyd1AcE798tWQKwng392LFzlBrkaDlQdCw5WxCRAgfdwqQNDURgpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7425 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-19_13,2024-04-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404190144 X-Proofpoint-GUID: 0tatvRs4jZXYYbuyG8czCPZxzTd0_SEx X-Proofpoint-ORIG-GUID: 0tatvRs4jZXYYbuyG8czCPZxzTd0_SEx X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org gcc/testsuite/ChangeLog: * c-c++-common/builtin-clear-padding-3.c: Adjust testcase. * g++.dg/ext/flexary12.C: Likewise. * g++.dg/ext/flexary19.C: Likewise. * g++.dg/ext/flexary2.C: Likewise. * g++.dg/ext/flexary3.C: Likewise. * g++.dg/ext/flexary36.C: Likewise. * g++.dg/ext/flexary4.C: Likewise. * g++.dg/ext/flexary5.C: Likewise. * g++.dg/ext/flexary8.C: Likewise. * g++.dg/torture/pr64280.C: Likewise. * gcc.dg/20050620-1.c: Likewise. * gcc.dg/940510-1.c: Likewise. --- .../c-c++-common/builtin-clear-padding-3.c | 10 ++-- gcc/testsuite/g++.dg/ext/flexary12.C | 6 +-- gcc/testsuite/g++.dg/ext/flexary19.C | 42 +++++++-------- gcc/testsuite/g++.dg/ext/flexary2.C | 2 +- gcc/testsuite/g++.dg/ext/flexary3.C | 2 +- gcc/testsuite/g++.dg/ext/flexary36.C | 2 +- gcc/testsuite/g++.dg/ext/flexary4.C | 54 +++++++++---------- gcc/testsuite/g++.dg/ext/flexary5.C | 4 +- gcc/testsuite/g++.dg/ext/flexary8.C | 8 +-- gcc/testsuite/g++.dg/torture/pr64280.C | 2 +- gcc/testsuite/gcc.dg/20050620-1.c | 2 +- gcc/testsuite/gcc.dg/940510-1.c | 4 +- 12 files changed, 68 insertions(+), 70 deletions(-) diff --git a/gcc/testsuite/c-c++-common/builtin-clear-padding-3.c b/gcc/testsuite/c-c++-common/builtin-clear-padding-3.c index d16cc6aad05f..a4f49f26db14 100644 --- a/gcc/testsuite/c-c++-common/builtin-clear-padding-3.c +++ b/gcc/testsuite/c-c++-common/builtin-clear-padding-3.c @@ -2,14 +2,12 @@ /* { dg-do compile } */ /* { dg-options "" } */ -union U { int a; char b[] __attribute__((aligned (2 * sizeof (int)))); }; /* { dg-error "flexible array member in union" } */ +union U { int a; char b[] __attribute__((aligned (2 * sizeof (int)))); }; struct V { int a; union U b; }; -struct W { int a; union U b; int c; }; void -foo (union U *u, struct V *v, struct W *w) +foo (union U *u, struct V *v) { - __builtin_clear_padding (u); - __builtin_clear_padding (v); - __builtin_clear_padding (w); + __builtin_clear_padding (u); /* { dg-error "flexible array member" "does not have well defined padding bits" } */ + __builtin_clear_padding (v); /* { dg-error "flexible array member" "does not have well defined padding bits" } */ } diff --git a/gcc/testsuite/g++.dg/ext/flexary12.C b/gcc/testsuite/g++.dg/ext/flexary12.C index b0964948731d..6ba4b6417135 100644 --- a/gcc/testsuite/g++.dg/ext/flexary12.C +++ b/gcc/testsuite/g++.dg/ext/flexary12.C @@ -6,7 +6,7 @@ // { dg-options "-Wno-pedantic" } struct A { - int a []; // { dg-error "flexible array member .A::a. in an otherwise empty .struct A." } + int a []; }; void f1 () @@ -40,7 +40,7 @@ void f2 () } struct D { - int a []; // { dg-error "flexible array member .D::a. in an otherwise empty .struct D." } + int a []; D (); }; @@ -52,7 +52,7 @@ D::D (): // { dg-error "initializer for flexible array member" } template struct C { - T a []; // { dg-error "flexible array member" } + T a []; }; void f3 () diff --git a/gcc/testsuite/g++.dg/ext/flexary19.C b/gcc/testsuite/g++.dg/ext/flexary19.C index abfbc43028af..9a06f9ca758f 100644 --- a/gcc/testsuite/g++.dg/ext/flexary19.C +++ b/gcc/testsuite/g++.dg/ext/flexary19.C @@ -12,7 +12,7 @@ struct S1 // The following declares a named data member of an unnamed struct // (i.e., it is not an anonymous struct). struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } s; }; @@ -21,7 +21,7 @@ struct S2 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } s[1]; }; @@ -30,7 +30,7 @@ struct S3 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } s[]; }; @@ -39,7 +39,7 @@ struct S4 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } s[2]; }; @@ -48,7 +48,7 @@ struct S5 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } s[1][2]; }; @@ -57,7 +57,7 @@ struct S6 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } s[][2]; }; @@ -66,7 +66,7 @@ struct S7 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } *s; }; @@ -75,7 +75,7 @@ struct S8 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } **s; }; @@ -84,7 +84,7 @@ struct S9 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } *s[1]; }; @@ -93,7 +93,7 @@ struct S10 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } *s[]; }; @@ -102,7 +102,7 @@ struct S11 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } **s[1]; }; @@ -111,7 +111,7 @@ struct S12 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } **s[]; }; @@ -120,7 +120,7 @@ struct S13 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } **s[2]; }; @@ -129,7 +129,7 @@ struct S14 int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } &s; }; @@ -138,7 +138,7 @@ struct S15 int i; typedef struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } T15; }; @@ -159,8 +159,8 @@ struct S17 { int i; - union { // anonymous union - int a[]; // { dg-error "flexible array member in union" } + union { // { dg-warning "invalid use" } + int a[]; // { dg-warning "flexible array member in union" } }; }; @@ -209,7 +209,7 @@ struct S22 struct S22S { static int i; - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } s; }; @@ -218,7 +218,7 @@ struct S23 struct { // { dg-warning "10:ISO C\\+\\+ prohibits anonymous struct" } static int i; // { dg-error "static data member" } - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } }; }; @@ -227,7 +227,7 @@ struct S24 static int i; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } s; }; @@ -252,7 +252,7 @@ struct S26 }; struct { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; // { dg-warning "in an otherwise empty" } } s; }; diff --git a/gcc/testsuite/g++.dg/ext/flexary2.C b/gcc/testsuite/g++.dg/ext/flexary2.C index c0253777a1e9..7095a3b0fb2d 100644 --- a/gcc/testsuite/g++.dg/ext/flexary2.C +++ b/gcc/testsuite/g++.dg/ext/flexary2.C @@ -13,7 +13,7 @@ struct A { struct B { B() {} - A a[]; // { dg-error "extension|flexible array .* in an otherwise empty" } + A a[]; }; struct C { diff --git a/gcc/testsuite/g++.dg/ext/flexary3.C b/gcc/testsuite/g++.dg/ext/flexary3.C index 8344b42dd163..7785c9b190a4 100644 --- a/gcc/testsuite/g++.dg/ext/flexary3.C +++ b/gcc/testsuite/g++.dg/ext/flexary3.C @@ -11,7 +11,7 @@ // { dg-options "" } struct s { - char c[]; // { dg-error "flexible array member .* in an otherwise empty" } + char c[]; }; int main() diff --git a/gcc/testsuite/g++.dg/ext/flexary36.C b/gcc/testsuite/g++.dg/ext/flexary36.C index 5bb827cfd0e0..87d6fb092100 100644 --- a/gcc/testsuite/g++.dg/ext/flexary36.C +++ b/gcc/testsuite/g++.dg/ext/flexary36.C @@ -25,7 +25,7 @@ struct { union { - int a[]; // { dg-error "flexible array member in union" } + int a[]; int b; } du = { 1 }; diff --git a/gcc/testsuite/g++.dg/ext/flexary4.C b/gcc/testsuite/g++.dg/ext/flexary4.C index bd28cf55de2b..a87b7e71edb6 100644 --- a/gcc/testsuite/g++.dg/ext/flexary4.C +++ b/gcc/testsuite/g++.dg/ext/flexary4.C @@ -11,79 +11,79 @@ #include "flexary.h" struct Sx { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; }; // Verify that non-data members or static data members either before // or after a flexible array member in an otherwise empty struct don't // suppress the diagnostic. struct Sx2 { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; typedef int I; }; struct Sx3 { typedef int I; - int a[]; // { dg-error "in an otherwise empty" } + int a[]; }; struct Sx4 { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; enum E { e }; }; struct Sx5 { enum E { e }; - int a[]; // { dg-error "in an otherwise empty" } + int a[]; }; struct Sx6 { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; static int i; }; struct Sx7 { static int i; - int a[]; // { dg-error "in an otherwise empty" } + int a[]; }; struct Sx8 { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; Sx8 () { } }; struct Sx9 { Sx9 () { } - int a[]; // { dg-error "in an otherwise empty" } + int a[]; }; struct Sx10 { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; virtual ~Sx10 () { } }; struct Sx11 { virtual ~Sx11 () { } - int a[]; // { dg-error "in an otherwise empty" } + int a[]; }; struct Sx12 { - int a[]; // { dg-error "in an otherwise empty" } + int a[]; virtual void foo () = 0; }; struct Sx13 { virtual void foo () = 0; - int a[]; // { dg-error "in an otherwise empty" } + int a[]; }; struct Sx14 { - int a[][1]; // { dg-error "in an otherwise empty" } + int a[][1]; }; struct Sx15 { typedef int A[]; - A a; // { dg-error "in an otherwise empty" } + A a; }; // Verify also that a zero-size array doesn't suppress the diagnostic. @@ -91,7 +91,7 @@ struct Sx16 { // a_0 below is diagnosed with -Wpedantic only and emits // warning: ISO C++ forbids zero-size arrays int a_0 [0]; - int a_x []; // { dg-error "in an otherwise empty" } + int a_x []; }; struct Sx17 { @@ -123,7 +123,7 @@ struct Sx19 { // so doesn't contribute its member to that of the enclosing struct. struct Sx20 { struct S { int i; }; - int a_x []; // { dg-error "in an otherwise empty" } + int a_x []; }; struct Sx21 { @@ -148,12 +148,12 @@ struct Sx24 { struct Sx25 { struct S { }; - S a_x []; // { dg-error "flexible array member" } + S a_x []; }; struct Sx26 { struct { } - a_x []; // { dg-error "flexible array member" } + a_x []; }; struct Sx27 { @@ -193,13 +193,13 @@ struct Sx32 { ASSERT_AT_END (Sx32, a); struct Sx33 { - int a []; // { dg-error "otherwise empty" } + int a []; friend int foo (); }; struct Sx34 { friend int foo (); - int a []; // { dg-error "otherwise empty" } + int a []; }; // Verify that intervening non-field declarations of members other @@ -277,7 +277,7 @@ ASSERT_AT_END (Sx44, a); struct S_S_S_x { struct A { struct B { - int a[]; // { dg-error "flexible array member" } + int a[]; } b; } a; }; @@ -300,7 +300,7 @@ struct NotAnon1 { // The following is not an anonymous struct -- the type is unnamed // but the object has a name. struct { - int bad[]; // { dg-error "otherwise empty" } + int bad[]; } name; }; @@ -328,7 +328,7 @@ ASSERT_AT_END (Anon3, good); struct Anon4 { struct { - int in_empty_struct[]; // { dg-error "in an otherwise empty" } + int in_empty_struct[]; }; }; @@ -366,7 +366,7 @@ struct Six { ASSERT_AT_END (Six, a); class Cx { - int a[]; // { dg-error "flexible array member" } + int a[]; }; class Cix { @@ -390,7 +390,7 @@ struct S0i { struct S_a0_ax { int a0[0]; - int ax[]; // { dg-error "flexible array member" } + int ax[]; }; struct S_a0_i_ax { @@ -417,7 +417,7 @@ struct Si_ax_a0 { struct S_u0_ax { union { } u[0]; - int ax[]; // { dg-error "flexible array member" } + int ax[]; }; struct S_a1_s2 { diff --git a/gcc/testsuite/g++.dg/ext/flexary5.C b/gcc/testsuite/g++.dg/ext/flexary5.C index d5ec13204966..3fb88c0e8a2c 100644 --- a/gcc/testsuite/g++.dg/ext/flexary5.C +++ b/gcc/testsuite/g++.dg/ext/flexary5.C @@ -13,7 +13,7 @@ struct S_no_diag: T { template struct STx_1: T { - char a[]; // { dg-error "flexible array member" } + char a[]; }; template @@ -37,7 +37,7 @@ struct E1: E<0>, E<1> { }; struct E2: E<2>, E<3> { }; struct D1: E1, E2 { - char a[]; // { dg-error "flexible array member" } + char a[]; }; struct NE { size_t i; }; diff --git a/gcc/testsuite/g++.dg/ext/flexary8.C b/gcc/testsuite/g++.dg/ext/flexary8.C index 7a1811deaff2..a0477f0fa410 100644 --- a/gcc/testsuite/g++.dg/ext/flexary8.C +++ b/gcc/testsuite/g++.dg/ext/flexary8.C @@ -4,26 +4,26 @@ union U_i_ax { int i; - int a[]; // { dg-error "flexible array member in union" } + int a[]; }; struct SU1 { union { - int a[]; // { dg-error "flexible array member in union" } + int a[]; }; }; struct SU2 { int n; union { - int a[]; // { dg-error "flexible array member in union" } + int a[]; }; }; struct SU3 { union { int n; - int a[]; // { dg-error "flexible array member in union" } + int a[]; }; }; diff --git a/gcc/testsuite/g++.dg/torture/pr64280.C b/gcc/testsuite/g++.dg/torture/pr64280.C index 5c569e864b4c..1ea70c4e766e 100644 --- a/gcc/testsuite/g++.dg/torture/pr64280.C +++ b/gcc/testsuite/g++.dg/torture/pr64280.C @@ -15,7 +15,7 @@ public: typedef int jmp_buf[]; struct C { - jmp_buf cond_; // { dg-error "flexible array member" } + jmp_buf cond_; }; class F { diff --git a/gcc/testsuite/gcc.dg/20050620-1.c b/gcc/testsuite/gcc.dg/20050620-1.c index befdd9636500..0a9e1d478454 100644 --- a/gcc/testsuite/gcc.dg/20050620-1.c +++ b/gcc/testsuite/gcc.dg/20050620-1.c @@ -5,7 +5,7 @@ void foo (void) { - struct { int i[]; } u; /* { dg-error "flexible array member" } */ + struct { int i[]; } u; } void diff --git a/gcc/testsuite/gcc.dg/940510-1.c b/gcc/testsuite/gcc.dg/940510-1.c index 46183831d096..9bcd7881f715 100644 --- a/gcc/testsuite/gcc.dg/940510-1.c +++ b/gcc/testsuite/gcc.dg/940510-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ /* { dg-options "-std=c89 -pedantic" } */ struct { int a[]; } x = { 0 }; /* { dg-warning "ISO C90 does not support flexible array members" } */ -/* { dg-error "flexible array member in a struct with no named members" "" { target *-*-* } .-1 } */ - +/* { dg-warning "flexible array member in a struct with no named members is a GCC extension" "" { target *-*-* } .-1 } */ +/* { dg-warning "initialization of a flexible array member" "" { target *-*-* } .-2 } */