[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2018-05-15 Thread vincent-gcc at vinc17 dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #27 from Vincent Lefèvre  ---
(In reply to Waynem Ccollough from comment #26)
> Does the issue already fixed? 

For the simplest cases, it is. But complex cases still trigger a warning, see
e.g. PR 80454.

[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2018-05-15 Thread waynemccollough at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

Waynem Ccollough  changed:

   What|Removed |Added

 CC||waynemccollough at gmx dot com

--- Comment #26 from Waynem Ccollough  ---
Does the issue already fixed? 

Waynem Ccollough
https://amsterdamdiary.com/

[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2017-04-18 Thread vincent-gcc at vinc17 dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

Vincent Lefèvre  changed:

   What|Removed |Added

 CC||vincent-gcc at vinc17 dot net

--- Comment #25 from Vincent Lefèvre  ---
On the same subject, I've reported a new bug: PR 80454.

[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2015-03-15 Thread nightstrike at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #24 from nightstrike nightstrike at gmail dot com ---
(In reply to Marek Polacek from comment #20)
 Sorry, the patch hasn't been applied to 4.9 nor 4.8 branch yet, and I don't
 think it should be backported as-is, because just today I found out that the
 patch contains a bug; see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64709

Now that PR64709 is fixed, could you please backport both to 4.9 (and possibly
4.8)?


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2015-02-06 Thread safinaskar at mail dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

Askar Safin safinaskar at mail dot ru changed:

   What|Removed |Added

 CC||safinaskar at mail dot ru

--- Comment #21 from Askar Safin safinaskar at mail dot ru ---
Same bug in clang: http://llvm.org/bugs/show_bug.cgi?id=21689
Related bug in POSIX: http://austingroupbugs.net/view.php?id=918

And I think this bug should be fixed even in C++, just because we should have
some uniform way to initialize addrinfo and mbstate_t in both C and C++ :)
(And gcc 4.9.2 emits warning for C++ but not for C)


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2015-02-06 Thread bugdal at aerifal dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #22 from Rich Felker bugdal at aerifal dot cx ---
The warning is probably correct for C++ because C++ has {} as its universal
zero initializer, and {0} may not (unsure about this; I'm not a C++ expert)
even be valid as an initializer for some C++ types. Comments from others more
experienced in C++ would be welcome.


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2015-02-06 Thread safinaskar at mail dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #23 from Askar Safin safinaskar at mail dot ru ---
Please remove {0} warning at least in cases where {0} is obviously OK (such as
addrinfo)


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2015-01-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #20 from Marek Polacek mpolacek at gcc dot gnu.org ---
Sorry, the patch hasn't been applied to 4.9 nor 4.8 branch yet, and I don't
think it should be backported as-is, because just today I found out that the
patch contains a bug; see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64709


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2015-01-21 Thread rogerdpack at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

roger pack rogerdpack at gmail dot com changed:

   What|Removed |Added

 CC||rogerdpack at gmail dot com

--- Comment #19 from roger pack rogerdpack at gmail dot com ---
Has this been applied yet? (If yes, in which version of gcc?) Seems to be a
popular problem, if it's this: 
http://stackoverflow.com/questions/13746033/how-to-repair-warning-missing-braces-around-initializer


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2014-08-03 Thread rose.garcia-eggl2fk at yopmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

Rose Garcia rose.garcia-eggl2fk at yopmail dot com changed:

   What|Removed |Added

 CC||rose.garcia-eggl2fk@yopmail
   ||.com

--- Comment #16 from Rose Garcia rose.garcia-eggl2fk at yopmail dot com ---
Created attachment 33228
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33228action=edit
backported fix for gcc 4.7.4

backported fix for gcc 4.7.4 attached. was tested building about 500 packages,
no regressions have been detected.


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2014-08-03 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #17 from Marek Polacek mpolacek at gcc dot gnu.org ---
I'm sorry, GCC 4.7 branch is already closed.


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2014-08-03 Thread rose.garcia-eggl2fk at yopmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #18 from Rose Garcia rose.garcia-eggl2fk at yopmail dot com ---
Created attachment 33229
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33229action=edit
backported fix for gcc 4.8.3

oh, is that so? that's unfortunate, as gcc  4.7 requires a C++ compiler to
bootstrap a C compiler.

either way, attaching a backport to gcc 4.8.3.
unlike the previous backport it wasn't heavily tested, but it seemed to do the
right thing in some simple testcases; and there was only one minor change
needed to get the upstream patch to apply (different argument count for
init_warning()).


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2014-06-05 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #12 from Jeffrey A. Law law at gcc dot gnu.org ---
Author: law
Date: Thu Jun  5 19:36:03 2014
New Revision: 211289

URL: http://gcc.gnu.org/viewcvs?rev=211289root=gccview=rev
Log:
2014-06-05  S. Gilles  sgil...@terpmail.umd.edu

PR c/53119
* c-typeck.c (push_init_level, process_init_element,
pop_init_level): Correct check for zero initialization, move
missing brace warning to respect zero initialization.

PR c/53119
* gcc.dg/pr53119.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.dg/pr53119.c
Modified:
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-typeck.c
trunk/gcc/testsuite/ChangeLog


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2014-06-05 Thread nightstrike at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

nightstrike nightstrike at gmail dot com changed:

   What|Removed |Added

 CC||nightstrike at gmail dot com

--- Comment #13 from nightstrike nightstrike at gmail dot com ---
This is related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36750

Can someone update the see also field?

Also, can this change be applied to c++ as well? Initializing a c struct in c++
code exhibits the same behavior.


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2014-06-05 Thread bugdal at aerifal dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #14 from Rich Felker bugdal at aerifal dot cx ---
In C++, the correct zero initializer is {}, not {0}. I'm not an expert in C++
but I think {0} in C++ might even be a constraint violation unless the brace
level happens to match.


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2014-06-05 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||mpolacek at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #15 from Marek Polacek mpolacek at gcc dot gnu.org ---
Should be fixed.


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2013-09-07 Thread manu at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #11 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
(In reply to JamesH from comment #10)
 
 Therefore, is there any progress on this bug?

I wouldn't expect any soon, unless new developers join GCC development and
decide to work on the C FE. Any takers?

[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2013-08-14 Thread jnahughes at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

JamesH jnahughes at googlemail dot com changed:

   What|Removed |Added

 CC||jnahughes at googlemail dot com

--- Comment #10 from JamesH jnahughes at googlemail dot com ---
I'd like to add that this is a definite problem when moving a codebase from a
different compiler to gcc. I'm having to individually fix up ={0} cases to
match the content of the structure being initialised, which is a PITA, and I
think against the C standard which I believe allows ={0} as a default zero
initialiser for structs of whatever content.

Therefore, is there any progress on this bug?


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2012-05-03 Thread manu at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

Manuel López-Ibáñez manu at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed|2012-04-25 00:00:00 |2012-05-03
 Ever Confirmed|0   |1

--- Comment #9 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-05-03 
17:54:37 UTC ---
Maybe related PR25137 

Confirmed by Joseph. Any help welcome!


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2012-04-26 Thread joseph at codesourcery dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #6 from joseph at codesourcery dot com joseph at codesourcery dot 
com 2012-04-26 10:37:26 UTC ---
On Wed, 25 Apr 2012, manu at gcc dot gnu.org wrote:

 It seems to me you are right. However, I cannot see how to check for ={0} at
 the point of the warning.
 
 Joseph, any ideas? This part of the C FE is ancient.

In general I think Jakub is more expert on the code for handling 
initializers than I am.


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2012-04-26 Thread manu at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

Manuel López-Ibáñez manu at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #7 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-04-26 
10:46:11 UTC ---
(In reply to comment #6)
 On Wed, 25 Apr 2012, manu at gcc dot gnu.org wrote:
 
  It seems to me you are right. However, I cannot see how to check for ={0} at
  the point of the warning.
  
  Joseph, any ideas? This part of the C FE is ancient.
 
 In general I think Jakub is more expert on the code for handling 
 initializers than I am.

OK, but do you agree that the warning should be silenced always for ={0}?

Jakub, do you have any pointers for this? At the point of the warning value
is null, so I am not sure how to check for ={0}. There is a boolean zeroinit
later, 

bool constructor_zeroinit =
 (VEC_length (constructor_elt, constructor_elements) == 1
   integer_zerop
  (VEC_index (constructor_elt, constructor_elements, 0)-value));

but this vector is not initialized in this case.


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2012-04-26 Thread joseph at codesourcery dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #8 from joseph at codesourcery dot com joseph at codesourcery dot 
com 2012-04-26 10:50:38 UTC ---
On Thu, 26 Apr 2012, manu at gcc dot gnu.org wrote:

 OK, but do you agree that the warning should be silenced always for ={0}?

Yes, I think that makes sense.


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2012-04-25 Thread bugdal at aerifal dot cx
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #2 from Rich Felker bugdal at aerifal dot cx 2012-04-25 18:01:41 
UTC ---
Sorry, I wrote the bug report without GCC in front of me. The correct name for
the warning option is -Wmissing-braces.


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2012-04-25 Thread manu at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #3 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-04-25 
18:12:29 UTC ---
I can't get reproduce this.

Could you provide a small reproducible testcase?
Plus the info asked here: http://gcc.gnu.org/bugs/#need


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2012-04-25 Thread bugdal at aerifal dot cx
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

--- Comment #4 from Rich Felker bugdal at aerifal dot cx 2012-04-25 18:32:08 
UTC ---
Created attachment 27242
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27242
minimal test case

Glibc's mbstate_t is defined as a struct whose first element is an int (not
another struct/union/array), so the warning does not happen there. I'm
uploading a minimal example case with an explicitly defined struct.


[Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}

2012-04-25 Thread manu at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

Manuel López-Ibáñez manu at gcc dot gnu.org changed:

   What|Removed |Added

 Status|WAITING |UNCONFIRMED
 CC||jsm28 at gcc dot gnu.org
 Ever Confirmed|1   |0
   Severity|normal  |enhancement

--- Comment #5 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-04-25 
22:13:11 UTC ---
It seems to me you are right. However, I cannot see how to check for ={0} at
the point of the warning.

Joseph, any ideas? This part of the C FE is ancient.