This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Need suggestion about bug 68425


I was looking at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68425

For testcase

    const int array[2] = { 1, 2, 3 ,6 ,89 ,193};


gcc 6.0.0 produces warnings like (spacing may get disturbed by gmail) :

68425.c: In function âmainâ:
68425.c:3:34: warning: excess elements in array initializer
     const int array[2] = { 1, 2, 3 ,6 ,89 ,193};
                                           ^
68425.c:3:34: note: (near initialization for âarrayâ)
68425.c:3:37: warning: excess elements in array initializer
     const int array[2] = { 1, 2, 3 ,6 ,89 ,193};
                                               ^
68425.c:3:37: note: (near initialization for âarrayâ)
68425.c:3:40: warning: excess elements in array initializer
     const int array[2] = { 1, 2, 3 ,6 ,89 ,193};
                                                   ^~
68425.c:3:40: note: (near initialization for âarrayâ)
68425.c:3:44: warning: excess elements in array initializer
     const int array[2] = { 1, 2, 3 ,6 ,89 ,193};
                                                        ^~~
68425.c:3:44: note: (near initialization for âarrayâ)


While clang gives :

68425.c:3:34: warning: excess elements in array initializer
    const int array[2] = { 1, 2, 3 ,6 ,89 ,193};
                                          ^
1 warning generated.


Wouldn't it be nice instead of multiple warnings if gcc gives single
warning like :

68425.c:3:34: warning: excess elements in array initializer (6
elements, expected 2)
    const int array[2] = { 1, 2, 3 ,6 ,89 ,193};
                                          ^




-- 
Thanks and Regards,
Prasad Ghangal


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]