From patchwork Wed Nov 30 17:18:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 27919 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1050528wrr; Wed, 30 Nov 2022 09:19:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf72QmnhUWBom1TMvwsD1UVFuYsUG+rjyneEUnLTsi1CRdH5xsQAknuAxuueYbAVcI6ENZvU X-Received: by 2002:a05:6402:3895:b0:468:15f1:54b5 with SMTP id fd21-20020a056402389500b0046815f154b5mr15501381edb.8.1669828758462; Wed, 30 Nov 2022 09:19:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669828758; cv=none; d=google.com; s=arc-20160816; b=lhx34+YgEsfze16Tr/09yn1rlzOWBR8zsgVFBplvRVf5mE9plUO46L4RjkK5YaRy27 r417u6no0qGHNv+PFEnwJOpweIDtzDgOmszuwcvTD8dpbkjAg+jP8lHlNP75dsD+y1gB 3O1try0fBdVS2PtAem84dcY/JSQUbCJSUlidGBct4uO0hKatMC6/4z2QSDqq1JqSevEP ukYYI+DxQSnwzYwr0AY0aw7jzBN9YIQMz0IofIZsY65QfOicWJIBCQi4K9bdl9F5zlQE ZcsUNZedn+B1BEAnrMyTN0x/k1+N/67MAquh/IrOXkSlNfmsqnqSQSOE/EnDkXAwIzbB sRaA== 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:mime-version :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=Rb4qXFBhHKQQhQ7cnRaAKwOPOs8aJ8e3nwCO7Ul/lko=; b=Nb+IsSDCQLLJxq1jsna3Y9lFAiNLvmLbLXmGI7eh80IoLjekTNsCA1e05wRBEJJLNx BVOPC+PHlkVpaHGFZmgAEtkDjBbUuaN41xL2bu3iTaQlv3JSQsGjyiOL2iJjyhzELNmT DVk3d7fmV3MhUXnFBVdSb8ZFbUQDPClnWuPbgcWtgp/KzyzzdpjwU/C5+uxz6vGD4K0S zW3m0TWOTMIhPMPfnn8zrx4HbOugZ5UiNd6OeN86Ni1DuRNH4Ux2lyZMct2p6nWodDxl TC72tvmOxHxEte57hVisiY+6djJauOkUDUYyfOqD64hofDnMXlVyPpGG5AynrfB/kV0D g/XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=EnuPxtRa; 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 sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id dn14-20020a05640222ee00b00465f6a9fbb3si1548027edb.155.2022.11.30.09.19.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 09:19:18 -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=@gcc.gnu.org header.s=default header.b=EnuPxtRa; 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 E92103858D37 for ; Wed, 30 Nov 2022 17:19:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E92103858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669828745; bh=Rb4qXFBhHKQQhQ7cnRaAKwOPOs8aJ8e3nwCO7Ul/lko=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=EnuPxtRan/ZIrDIqV/Z4s8xYQypdYt27z/SZf6hARIMR8ksQVaUtqC9sOU5+Io+tX 26bA4MitKZIbdBpZwdIdU1qPU9hakdV/3/viRKO8CXn23r5Fx43u1K/VL1x1UoOw6X hfJDZu3pQUBRThJVxbrSj1IaswwDFw3wG/T0uhRU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by sourceware.org (Postfix) with ESMTPS id A68C03858D37 for ; Wed, 30 Nov 2022 17:18:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A68C03858D37 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AUCgSZC021060 for ; Wed, 30 Nov 2022 09:18:23 -0800 Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3m3k6wgpev-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 30 Nov 2022 09:18:23 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 30 Nov 2022 09:18:20 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 30 Nov 2022 09:18:20 -0800 Received: from linux.wrightpinski.org.com (unknown [10.69.242.198]) by maili.marvell.com (Postfix) with ESMTP id 9A3C93F7051; Wed, 30 Nov 2022 09:18:20 -0800 (PST) To: CC: Andrew Pinski Subject: [PATCH 1/2] Fix C/107926: Wrong error message when initializing char array Date: Wed, 30 Nov 2022 09:18:14 -0800 Message-ID: <1669828695-18532-1-git-send-email-apinski@marvell.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Proofpoint-GUID: CZZ2J-vkAOp0Y-FG0r8kZKQsltmGQ9Ly X-Proofpoint-ORIG-GUID: CZZ2J-vkAOp0Y-FG0r8kZKQsltmGQ9Ly X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-30_04,2022-11-30_02,2022-06-22_01 X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, 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: apinski--- via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: apinski@marvell.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750942359817764035?= X-GMAIL-MSGID: =?utf-8?q?1750942359817764035?= From: Andrew Pinski The problem here is the code which handles {"a"} is supposed to handle the case where the is something after the string but it only handles the case where there is another string so we go down the other path and error out saying "excess elements in struct initializer" even though this was a character array. To fix this, we need to move the ckeck if the initializer is a string after the check for array and initializer. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Adnrew Pinski gcc/c/ChangeLog: PR c/107926 * c-typeck.cc (process_init_element): Move the ceck for string cst until after the error message. gcc/testsuite/ChangeLog: PR c/107926 * gcc.dg/init-excess-3.c: New test. --- gcc/c/c-typeck.cc | 15 ++++++++++----- gcc/testsuite/gcc.dg/init-excess-3.c | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/init-excess-3.c diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index e06f052..0fc382c 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -10623,17 +10623,22 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, /* Handle superfluous braces around string cst as in char x[] = {"foo"}; */ - if (string_flag - && constructor_type + if (constructor_type && !was_designated && TREE_CODE (constructor_type) == ARRAY_TYPE && INTEGRAL_TYPE_P (TREE_TYPE (constructor_type)) && integer_zerop (constructor_unfilled_index)) { if (constructor_stack->replacement_value.value) - error_init (loc, "excess elements in % array initializer"); - constructor_stack->replacement_value = value; - return; + { + error_init (loc, "excess elements in % array initializer"); + return; + } + else if (string_flag) + { + constructor_stack->replacement_value = value; + return; + } } if (constructor_stack->replacement_value.value != NULL_TREE) diff --git a/gcc/testsuite/gcc.dg/init-excess-3.c b/gcc/testsuite/gcc.dg/init-excess-3.c new file mode 100644 index 0000000..7741261 --- /dev/null +++ b/gcc/testsuite/gcc.dg/init-excess-3.c @@ -0,0 +1,15 @@ +/* Test for various cases of excess initializers for char arrays, + bug 107926. */ +/* { dg-do compile } */ +/* { dg-options "" } */ + + +char s0[] = {"abc",1}; /* { dg-error "array initializer|near init" } */ +char s1[] = {"abc","a"}; /* { dg-error "array initializer|near init" } */ +char s2[] = {1,"abc"}; /* { dg-error "array initializer|near init|computable at load time" } */ +/* { dg-warning "integer from pointer without a cast" "" { target *-*-* } .-1 } */ + +char s3[5] = {"abc",1}; /* { dg-error "array initializer|near init" } */ +char s4[5] = {"abc","a"}; /* { dg-error "array initializer|near init" } */ +char s5[5] = {1,"abc"}; /* { dg-error "array initializer|near init|computable at load time" } */ +/* { dg-warning "integer from pointer without a cast" "" { target *-*-* } .-1 } */ From patchwork Wed Nov 30 17:18:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 27920 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1050551wrr; Wed, 30 Nov 2022 09:19:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf5bJVNQbq3k1jsq5Ikjy6P3xqROOsgQQpZyIGDlmIRVrYgWeN6ohu2FktkBRBWHzdGMWO95 X-Received: by 2002:a17:906:39cf:b0:7c0:9875:42d1 with SMTP id i15-20020a17090639cf00b007c0987542d1mr4559866eje.310.1669828761145; Wed, 30 Nov 2022 09:19:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669828761; cv=none; d=google.com; s=arc-20160816; b=X15FBPjhn1ATu0Z87aZr/e0ejwNU2myhd/0F9jtFOrzcMAMWFCwTkw4zY1W9Yz85Bd 7KuZXdXc31Zs0JmAmjsI6un4xV/HNsMU/7pP8SSp1tGGuMUGf003wUWHfpMpEhI/t2jp +k3YKxlFQUQcjPFHcSnRJ8K+9Np0iVKv2PGwDLckpjv1ovd35FIt0fz8E/KsJU8BvTZg LueDGhWtnW1br8dtUC3KC6jG6FTmoZ1mZQdw90vDYrXiHW/zWUSMak6xBJTcMFBmNYfU A34CvXO4EObid7Ci5pzHhBsn0EEWsrBP01GOmRTz0VXcz/Jma+C0cQcDI6G+urYSMMgS B/MQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=snFTUEITY9tP8xNB58bnD7FRyVG4yFjPkZ9FB+fa5/U=; b=tGPDbzxRUNwD4jHfw4TPl+OZuPdQyfhtQx51BS0IxUfXW7kVF9rPyejnOTp2WewSV7 otQ7cL9jdY+FTnBu1QJuGP3lZJgTNj+K5Cl1ZTukvww1XKe48JlD4xYyIlYRaHJyDYwz Wyys1yMFv2RlzZdFkVAyTu8JDkpQ5/V4Jx2nRjhy9IjrI5wZthqYJbYDwbJnCrxVxugC 0MTort63LTbvQ5yC04y9uJR/aQv7sSZWi8xXJd1v7GojRn51TIAXsPeeL+gmQgzHOi8c MRVlhG2Ef6fydGGyqRyqyz9Ug1J1ANsCaMLn2Uwg1rDaV9xCIRBbwteniORwEB8oeZk2 bNqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=um3CEB3T; 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 sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id m9-20020a170906848900b0078e19e971b2si1370911ejx.915.2022.11.30.09.19.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 09:19:21 -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=@gcc.gnu.org header.s=default header.b=um3CEB3T; 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 DFB9B3854553 for ; Wed, 30 Nov 2022 17:19:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DFB9B3854553 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669828747; bh=snFTUEITY9tP8xNB58bnD7FRyVG4yFjPkZ9FB+fa5/U=; h=To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=um3CEB3Tq5Jk42RTPsErtflMeEMIJzH3CC4FepOiimlaBcA8Qe0La/vLYX8TRiHhb f/fGebpIXMEDMW10Pq11+0085F6ohDH7VcRlAsNgJEnvFJBxpQGlicjYD8PFm9qQJy qCrplthhma5stXK8J/0qVLUunUIQv3wiHB1vofzs= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id 30FCA385842E for ; Wed, 30 Nov 2022 17:18:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 30FCA385842E Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AU8rTWO029435 for ; Wed, 30 Nov 2022 09:18:23 -0800 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3m642d9qac-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 30 Nov 2022 09:18:22 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 30 Nov 2022 09:18:21 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 30 Nov 2022 09:18:21 -0800 Received: from linux.wrightpinski.org.com (unknown [10.69.242.198]) by maili.marvell.com (Postfix) with ESMTP id 0C2CA3F7055; Wed, 30 Nov 2022 09:18:20 -0800 (PST) To: CC: Andrew Pinski Subject: [PATCH 2/2] Improve error message for excess elements in array initializer from {"a"} Date: Wed, 30 Nov 2022 09:18:15 -0800 Message-ID: <1669828695-18532-2-git-send-email-apinski@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1669828695-18532-1-git-send-email-apinski@marvell.com> References: <1669828695-18532-1-git-send-email-apinski@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: O6czcIwZW5125QCjdSXk2hlJU4He1wMh X-Proofpoint-GUID: O6czcIwZW5125QCjdSXk2hlJU4He1wMh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-30_04,2022-11-30_02,2022-06-22_01 X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, 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: apinski--- via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: apinski@marvell.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750942363374690534?= X-GMAIL-MSGID: =?utf-8?q?1750942363374690534?= From: Andrew Pinski So char arrays are not the only type that be initialized from {"a"}. We can have wchar_t (L"") and char16_t (u"") types too. So let's print out the type of the array instead of just saying char. Note in the testsuite I used regex . to match '[' and ']' as I could not figure out how many '\' I needed. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/c/ChangeLog: * c-typeck.cc (process_init_element): Print out array type for excessive elements. gcc/testsuite/ChangeLog: * gcc.dg/init-bad-1.c: Update error message. * gcc.dg/init-bad-2.c: Likewise. * gcc.dg/init-bad-3.c: Likewise. * gcc.dg/init-excess-3.c: Likewise. * gcc.dg/pr61096-1.c: Likewise. --- gcc/c/c-typeck.cc | 2 +- gcc/testsuite/gcc.dg/init-bad-1.c | 2 +- gcc/testsuite/gcc.dg/init-bad-2.c | 2 +- gcc/testsuite/gcc.dg/init-bad-3.c | 2 +- gcc/testsuite/gcc.dg/init-excess-3.c | 12 ++++++------ gcc/testsuite/gcc.dg/pr61096-1.c | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 0fc382c..f1a1752 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -10631,7 +10631,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit, { if (constructor_stack->replacement_value.value) { - error_init (loc, "excess elements in % array initializer"); + error_init (loc, "excess elements in %qT initializer", constructor_type); return; } else if (string_flag) diff --git a/gcc/testsuite/gcc.dg/init-bad-1.c b/gcc/testsuite/gcc.dg/init-bad-1.c index 0da10c3..7c80006 100644 --- a/gcc/testsuite/gcc.dg/init-bad-1.c +++ b/gcc/testsuite/gcc.dg/init-bad-1.c @@ -18,7 +18,7 @@ char s[1] = "x"; char s1[1] = { "x" }; char t[1] = "xy"; /* { dg-warning "initializer-string for array of 'char' is too long" } */ char t1[1] = { "xy" }; /* { dg-warning "initializer-string for array of 'char' is too long" } */ -char u[1] = { "x", "x" }; /* { dg-error "excess elements in 'char' array initializer" } */ +char u[1] = { "x", "x" }; /* { dg-error "excess elements in 'char.1.' initializer" } */ /* { dg-message "near init" "near" { target *-*-* } .-1 } */ int i = { }; diff --git a/gcc/testsuite/gcc.dg/init-bad-2.c b/gcc/testsuite/gcc.dg/init-bad-2.c index 4775c48..57fd9f9 100644 --- a/gcc/testsuite/gcc.dg/init-bad-2.c +++ b/gcc/testsuite/gcc.dg/init-bad-2.c @@ -19,7 +19,7 @@ char s[1] = "x"; char s1[1] = { "x" }; char t[1] = "xy"; /* { dg-warning "initializer-string for array of 'char' is too long" } */ char t1[1] = { "xy" }; /* { dg-warning "initializer-string for array of 'char' is too long" } */ -char u[1] = { "x", "x" }; /* { dg-error "excess elements in 'char' array initializer" } */ +char u[1] = { "x", "x" }; /* { dg-error "excess elements in 'char.1.' initializer" } */ /* { dg-message "near init" "near" { target *-*-* } .-1 } */ int j = { 1 }; diff --git a/gcc/testsuite/gcc.dg/init-bad-3.c b/gcc/testsuite/gcc.dg/init-bad-3.c index c5c338d..c22e8ec 100644 --- a/gcc/testsuite/gcc.dg/init-bad-3.c +++ b/gcc/testsuite/gcc.dg/init-bad-3.c @@ -19,7 +19,7 @@ char s[1] = "x"; char s1[1] = { "x" }; char t[1] = "xy"; /* { dg-error "initializer-string for array of 'char' is too long" } */ char t1[1] = { "xy" }; /* { dg-error "initializer-string for array of 'char' is too long" } */ -char u[1] = { "x", "x" }; /* { dg-error "excess elements in 'char' array initializer" } */ +char u[1] = { "x", "x" }; /* { dg-error "excess elements in 'char.1.' initializer" } */ /* { dg-message "near init" "near" { target *-*-* } .-1 } */ int j = { 1 }; diff --git a/gcc/testsuite/gcc.dg/init-excess-3.c b/gcc/testsuite/gcc.dg/init-excess-3.c index 7741261..c03a984 100644 --- a/gcc/testsuite/gcc.dg/init-excess-3.c +++ b/gcc/testsuite/gcc.dg/init-excess-3.c @@ -4,12 +4,12 @@ /* { dg-options "" } */ -char s0[] = {"abc",1}; /* { dg-error "array initializer|near init" } */ -char s1[] = {"abc","a"}; /* { dg-error "array initializer|near init" } */ -char s2[] = {1,"abc"}; /* { dg-error "array initializer|near init|computable at load time" } */ +char s0[] = {"abc",1}; /* { dg-error "'char..' initializer|near init" } */ +char s1[] = {"abc","a"}; /* { dg-error "'char..' initializer|near init" } */ +char s2[] = {1,"abc"}; /* { dg-error "'char..' initializer|near init|computable at load time" } */ /* { dg-warning "integer from pointer without a cast" "" { target *-*-* } .-1 } */ -char s3[5] = {"abc",1}; /* { dg-error "array initializer|near init" } */ -char s4[5] = {"abc","a"}; /* { dg-error "array initializer|near init" } */ -char s5[5] = {1,"abc"}; /* { dg-error "array initializer|near init|computable at load time" } */ +char s3[5] = {"abc",1}; /* { dg-error "'char.5.' initializer|near init" } */ +char s4[5] = {"abc","a"}; /* { dg-error "'char.5.' initializer|near init" } */ +char s5[5] = {1,"abc"}; /* { dg-error "'char.5.' initializer|near init|computable at load time" } */ /* { dg-warning "integer from pointer without a cast" "" { target *-*-* } .-1 } */ diff --git a/gcc/testsuite/gcc.dg/pr61096-1.c b/gcc/testsuite/gcc.dg/pr61096-1.c index f41789c..90ffb80 100644 --- a/gcc/testsuite/gcc.dg/pr61096-1.c +++ b/gcc/testsuite/gcc.dg/pr61096-1.c @@ -47,7 +47,7 @@ __extension__ int a15[10] = {[2 ... 1] = 4 }; /* { dg-error "31:empty index rang __extension__ int a16[10] = {[2 ... 100] = 4 }; /* { dg-error "31:array index range in initializer exceeds array bounds" } */ int a17[] = { .B = 1 }; /* { dg-error "15:field name not in record or union initializer" } */ int a18[] = { e }; /* { dg-error "15:initializer element is not constant" } */ -char a19[1] = { "x", "x" }; /* { dg-error "22:excess elements in 'char' array initializer" } */ +char a19[1] = { "x", "x" }; /* { dg-error "22:excess elements in 'char.1.' initializer" } */ void bar (void)