From: Jeff Law <jeffreyalaw@gmail.com>
To: apinski@marvell.com, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 1/2] Fix C/107926: Wrong error message when initializing char array
Date: Sun, 30 Apr 2023 10:23:43 -0600 [thread overview]
Message-ID: <7ce20e57-0687-3d63-f7a5-f89755f3c5ba@gmail.com> (raw)
In-Reply-To: <1669828695-18532-1-git-send-email-apinski@marvell.com>
On 11/30/22 10:18, apinski--- via Gcc-patches wrote:
> From: Andrew Pinski <apinski@marvell.com>
>
> 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
prev parent reply other threads:[~2023-04-30 16:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 17:18 apinski
2022-11-30 17:18 ` [PATCH 2/2] Improve error message for excess elements in array initializer from {"a"} apinski
2022-11-30 23:05 ` Segher Boessenkool
2022-11-30 23:17 ` Andreas Schwab
2022-11-30 23:31 ` Segher Boessenkool
2023-04-30 16:24 ` Jeff Law
2022-11-30 17:29 ` [PATCH 1/2] Fix C/107926: Wrong error message when initializing char array Jakub Jelinek
2023-04-30 16:23 ` Jeff Law [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7ce20e57-0687-3d63-f7a5-f89755f3c5ba@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=apinski@marvell.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).