Re: Need suggestion about bug 68425

2016-04-03 Thread Manuel López-Ibáñez
On 3 April 2016 at 16:56, Prasad Ghangal wrote: > > Also for > > int array[10]; > array[100]=10; > > Currently, GCC doesn't emit any warning (even with -Wall option) > > Wouldn't it be nice if GCC gives some warning like Clang, which gives: > > foo.c:4:3: warning: array index 100 is past the end o

Re: Need suggestion about bug 68425

2016-04-03 Thread Prasad Ghangal
On 5 March 2016 at 01:06, David Malcolm wrote: > On Wed, 2016-02-24 at 17:56 +0530, Prasad Ghangal wrote: >> Thanks Prathamesh and Joseph for your suggestions. >> >> Here is my updated patch : >> >> for test cases: >> >> const int array[5] = {1, 2, 3}; >> const int array1[3] = {1, 2, 3, 6}

Re: Need suggestion about bug 68425

2016-03-04 Thread Manuel López-Ibáñez
On 4 March 2016 at 19:36, David Malcolm wrote: > Those caret locations look wrong to me - they don't seem to be > underlining the pertinent source. Is that what the patched compiler is > printing, or did things get messed up somewhere via email? Probably Gmail sucks at sending plain text. It suc

Re: Need suggestion about bug 68425

2016-03-04 Thread David Malcolm
On Wed, 2016-02-24 at 17:56 +0530, Prasad Ghangal wrote: > Thanks Prathamesh and Joseph for your suggestions. > > Here is my updated patch : > > for test cases: > > const int array[5] = {1, 2, 3}; > const int array1[3] = {1, 2, 3, 6}; > const int array2[4] = {1, 2, 3, 6, 89}; > c

Re: Need suggestion about bug 68425

2016-03-03 Thread Prasad Ghangal
PING I would like to know if there is other better way of doing this. On 24 February 2016 at 17:56, Prasad Ghangal wrote: > Thanks Prathamesh and Joseph for your suggestions. > > Here is my updated patch : > > for test cases: > > const int array[5] = {1, 2, 3}; > const int array1[3] = {1

Re: Need suggestion about bug 68425

2016-02-24 Thread Prasad Ghangal
Thanks Prathamesh and Joseph for your suggestions. Here is my updated patch : for test cases: const int array[5] = {1, 2, 3}; const int array1[3] = {1, 2, 3, 6}; const int array2[4] = {1, 2, 3, 6, 89}; const int array3[5] = {1, 2, 3, 6, 89, 193}; const int array4[3] = {1, 2,

Re: Need suggestion about bug 68425

2016-02-22 Thread Joseph Myers
On Sun, 21 Feb 2016, Prasad Ghangal wrote: > - pedwarn_init (loc, 0, > -"excess elements in array initializer"); > + pedwarn_init (loc, 0, "excess elements in array initializer " > + "(%lu elements, expected %lu)", > + tree_to_uhwi (const

Re: Need suggestion about bug 68425

2016-02-21 Thread Prathamesh Kulkarni
On 21 February 2016 at 12:32, Prasad Ghangal wrote: > I was working on PR68425, > > my untested patch : > > > diff --git a/trunk/gcc/c/c-typeck.c b/trunk/gcc/c/c-typeck.c > --- a/trunk/gcc/c/c-typeck.c(revision 232768) > +++ b/trunk/gcc/c/c-typeck.c(working copy) > @@ -5856,7 +5856,7 @@ >

Re: Need suggestion about bug 68425

2016-02-20 Thread Prasad Ghangal
I was working on PR68425, my untested patch : diff --git a/trunk/gcc/c/c-typeck.c b/trunk/gcc/c/c-typeck.c --- a/trunk/gcc/c/c-typeck.c(revision 232768) +++ b/trunk/gcc/c/c-typeck.c(working copy) @@ -5856,7 +5856,7 @@ component name is taken from the spelling stack. */ static void

Re: Need suggestion about bug 68425

2016-02-19 Thread Manuel López-Ibáñez
On 19 February 2016 at 19:13, David Malcolm wrote: >> 68425.c:3:34: warning: excess elements in array initializer (6 >> elements, >> expected 2) >>const int array[2] = { 1, 2, 3 ,6 ,89 ,193}; >> ^ > > Yes, that would be ideal. Unfortunately,

Re: Need suggestion about bug 68425

2016-02-19 Thread David Malcolm
On Thu, 2016-02-18 at 14:28 +, Manuel López-Ibáñez wrote: > On 18/02/16 11:40, Prasad Ghangal wrote: > > 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)

Re: Need suggestion about bug 68425

2016-02-18 Thread Manuel López-Ibáñez
On 18/02/16 11:40, Prasad Ghangal wrote: 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};

Need suggestion about bug 68425

2016-02-18 Thread Prasad Ghangal
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