This is the mail archive of the gcc-bugs@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]

[Bug c/70924] Wrong position for "warning: missing braces around initializer [-Wmissing-braces]"


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

Zhendong Su <su at cs dot ucdavis.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |su at cs dot ucdavis.edu

--- Comment #1 from Zhendong Su <su at cs dot ucdavis.edu> ---
Here is another test pinpointing the same issue: 

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160626 (experimental) [trunk revision 237789] (GCC) 
$ 
$ gcc-trunk -c -Wmissing-braces check.c
check.c:1:15: warning: missing braces around initializer [-Wmissing-braces]
 int a[3][1] = { { 0 }, { 1 }, 2 };
               ^
check.c:1:15: note: (near initialization for âaâ)
$ 
$ clang -c -Wmissing-braces check.c
check.c:1:31: warning: suggest braces around initialization of subobject
[-Wmissing-braces]
int a[3][1] = { { 0 }, { 1 }, 2 };
                              ^
                              {}
1 warning generated.
$ 
$ cat check.c
int a[3][1] = { { 0 }, { 1 }, 2 };

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