[Bug c/91839] missing error diagnosis for undeclared identifier
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91839 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org --- Comment #5 from Eric Gallager --- There's another bug that this one is reminding me of, but I can't seem to find it right now...
[Bug c/91839] missing error diagnosis for undeclared identifier
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91839 Manuel López-Ibáñez changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED CC||manu at gcc dot gnu.org Resolution|--- |WONTFIX --- Comment #4 from Manuel López-Ibáñez --- (In reply to tangyixuan from comment #3) > Error handler should not stop at the first error and report the errors as > many as possible. This is not possible in general as the error may cause a cascade of errors that are only "errors" because of the first one. In that case, it is better to stop so that the user knows which error is the actual important one to fix. > Maybe it could be improved at some extent. You are welcome to try: https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps GCC will always need more contributors and you are very welcome to contribute in this area if it is interesting for you. However, existing GCC developers should better spend their time on other more important bugs or features.
[Bug c/91839] missing error diagnosis for undeclared identifier
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91839 Jonathan Wakely changed: What|Removed |Added Severity|normal |enhancement
[Bug c/91839] missing error diagnosis for undeclared identifier
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91839 --- Comment #3 from tangyixuan --- (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.
[Bug c/91839] missing error diagnosis for undeclared identifier
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91839 Jonathan Wakely changed: What|Removed |Added CC||dmalcolm at gcc dot gnu.org --- Comment #2 from Jonathan Wakely --- 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.
[Bug c/91839] missing error diagnosis for undeclared identifier
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91839 --- Comment #1 from tangyixuan --- Hi, there still exists the above error defect in recent GCC: no error suggestions about ‘l_2’. The reduced code is as follow: static long a //error static int f1(void; //error static int f1(void) { int l_24[0] = {0}; return l_2[0]; //error } $ gcc-trunk -c s.c s.c:1:14: error: expected ‘;’ before ‘static’ 1 | static long a //error | ^ | ; 2 | static int f1(void; //error | ~~ s.c:3:13: error: storage class specified for parameter ‘f1’ 3 | static int f1(void) | ^~ s.c:4:1: error: expected ‘;’, ‘,’ or ‘)’ before ‘{’ token 4 | { | ^ $ gcc-trunk -version Target: x86_64-pc-linux-gnu Configured with: ../gcc-10-20191124/configure --prefix=/usr/local/gcc-20191124 --enable-checking=release --enable-languages=c,c++ --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.0.0 20191124 (experimental) (GCC) Best regards