From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id 0023C3858D35 for ; Sun, 30 Apr 2023 16:23:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0023C3858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-329326b4f10so3974875ab.2 for ; Sun, 30 Apr 2023 09:23:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682871825; x=1685463825; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=W33ZidVPcKlukKV0eXaw32b+RYs9GMHQZVkPl4y6DOM=; b=nYgf9EGwSncLvdr6nuYlnA6f9YXd7Emp4cbzktYc+uNoNSZ3jtF1vSfe6yOpzPKRnW wfzlTIblARoMqMNoPaym+q/KyQHOm/mm2ml0bAg4h3draDe5UFZwDLa4lNpahMaZNhiR Iig3iLjQcCxP034zgswlYugyQxfBuTagJMSrMqlvBx3UEmun8uM7iRajcglAN47kqWZT lOETD/se/+kQagv4rxSTPZctOkX74EJEn2EYLUnvtGP60ABk3tpwT0VP/OiXJNoyrslG WPl+neNyY0bHQRhE/B7msg1LpTxQc/itW7PxycQbwQiMogwdRGsSLNGPZmL6DJKktqKk WBOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682871825; x=1685463825; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=W33ZidVPcKlukKV0eXaw32b+RYs9GMHQZVkPl4y6DOM=; b=KR2l2+ja72BoBPJGvcwX7T6WNyjUdyk1ToTJC2b5wtvJqqFJ+yM/TOMBZTDaPNt9x9 HMYHNrrf8Z4Dh84/HV1fYXTMzv7IVLqKx9c9LJoxpeosfSI/zqbz3hV0DyELnTgXtGMA n85jbelrvdt3iq4MaB+awONRJla6nm7nhpqkFd8AJ2jVlUDcrh+XLLkCjoUkKv0CQXyu Vq9IPQ8/IUUGN4SqWOKm6vaB0jXlWwzwZrwmuQF9qpa2mw9uICgO8hxEkeaMAAKQKq+e VWKKt1VVh4z43kuJWB6E7tOBSF0gfmZ7PCltayMuYtRROLRLmsOYIRkHI9KZwwzPxPn0 d2PA== X-Gm-Message-State: AC+VfDxRC15YzOu7c9uC65m0QgkdUMUklECT/SPBWJEvu+7yxg4TNUTA dKVB+RiS9snPQYq250crDVBtJNCn3t0= X-Google-Smtp-Source: ACHHUZ7UlscdomzLn5pvVT2KcJA7znTJDQz/QNVgTMviBVQZcmFTwULuTjJ46lEe/excj+xoTeQzGA== X-Received: by 2002:a5d:9a11:0:b0:764:1ed4:8889 with SMTP id s17-20020a5d9a11000000b007641ed48889mr7330432iol.11.1682871824733; Sun, 30 Apr 2023 09:23:44 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::99f? ([2601:681:8600:13d0::99f]) by smtp.gmail.com with ESMTPSA id e22-20020a5d9256000000b0076356c2d1acsm7144676iol.52.2023.04.30.09.23.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 30 Apr 2023 09:23:44 -0700 (PDT) Message-ID: <7ce20e57-0687-3d63-f7a5-f89755f3c5ba@gmail.com> Date: Sun, 30 Apr 2023 10:23:43 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH 1/2] Fix C/107926: Wrong error message when initializing char array Content-Language: en-US To: apinski@marvell.com, gcc-patches@gcc.gnu.org References: <1669828695-18532-1-git-send-email-apinski@marvell.com> From: Jeff Law In-Reply-To: <1669828695-18532-1-git-send-email-apinski@marvell.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 List-Id: On 11/30/22 10:18, apinski--- via Gcc-patches wrote: > 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. OK jeff