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

            Bug ID: 91839
           Summary: missing error diagnosis for undeclared identifier
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tangyixuan at mail dot dlut.edu.cn
  Target Milestone: ---

GCC-trunk omits the error dignosis about "l_2" in the following error code:

$ cat s.c
  static long a                        //error
  static int  func_1(void;      //error
  static int  func_1(void)
  {
      int l_24[4] = {{9L},{(-1L)},{9L},{(-1L)}};
      return l_2[2];                  //error
  }
  int main()
  {
      func_1();
      return 0;
  }

$ ../gcc-trunk/gcc s.c

gcc version 10.0.0 20190913 (experimental) (GCC)
target: Ubuntu 4.8.5-4ubuntu8~14.04.2

s.c:1:14: error: expected ‘;’ before ‘static’
 static long a
                      ^
                       ;
 static int  func_1(void;
 ~~~~~~       
s.c:3:13: error: storage class specified for parameter ‘func_1’
 static int  func_1(void)
                  ^~~~~~
s.c:4:1: error: expected ‘;’, ‘,’ or ‘)’ before ‘{’ token
 {
 ^

However, when compiled with clang:                     
$ clang-8.0 -w -ferror-limit=0 s.c
s.c:1:14: error: expected ';' after top level declarator
 static long a
                      ^
                       ;
s.c:2:24: error: expected ')'
 static int  func_1(void;
                              ^
s.c:6:12: error: use of undeclared identifier 'l_2'; did you mean 'l_24'?
 return l_2[2];
             ^~~
             l_24
3 errors generated.

Reply via email to