https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91839

--- Comment #3 from tangyixuan <tangyixuan at mail dot dlut.edu.cn> ---
(In reply to Jonathan Wakely from comment #2)
> I can confirm GCC doesn't suggest l_24, but I'm not sure it's reasonable to
> expect it to do so after so many parse errors.
> 
> If you fix the first two errors then you do get it:
> 
> 91839.c:6:10: error: ‘l_2’ undeclared (first use in this function); did you
> mean ‘l_24’?
>     6 |   return l_2[0];      //error
>       |          ^~~
>       |          l_24
> 
> 
> Your code is ill-formed. GCC tells you it's ill-formed. I don't see a bug
> here.
Hi, thanks for your reply.
Error handler should not stop at the first error and report the errors as many
as possible.
When there are two errors in code, the second error of undeclared ‘b’ is
ignored:
static int  f1(void;   //error
static int  f1(void)
{
  return b;      //error
}

$gcc -c s.c
s.c:2:13: error: storage class specified for parameter ‘f1’
    2 | static int  f1(void)
      |             ^~
s.c:3:1: error: expected ‘;’, ‘,’ or ‘)’ before ‘{’ token
    3 | {
      | 

Maybe it could be improved at some extent.

Reply via email to