public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0}
@ 2012-04-25 17:04 bugdal at aerifal dot cx
2012-04-25 17:53 ` [Bug c/53119] " manu at gcc dot gnu.org
` (22 more replies)
0 siblings, 23 replies; 24+ messages in thread
From: bugdal at aerifal dot cx @ 2012-04-25 17:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
Bug #: 53119
Summary: -Wbraces wrongly warns about universal zero
initializer {0}
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: bugdal@aerifal.cx
In C, {0} is the universal zero initializer equivalent to C++'s {} (the latter
being invalid in C). It is necessary to use whenever you want a
zero-initialized object of a complete but conceptually-opaque or
implementation-defined type. The classic example in the C standard library is
mbstate_t:
mbstate_t state = { 0 }; /* correctly zero-initialized */
versus the common but nonportable:
mbstate_t state;
memset(&state, 0, sizeof state);
In this case, gcc -Wbraces (which is included in -Wall) actively discourages
the programmer from writing the correct form of the code by throwing ugly
warnings.
Note that if you want to eliminate warnings and write portable code, the *only*
way to zero-initialize an object like this is:
static const mbstate_t zero_state;
mbstate_t state = zero_state;
(i.e. creating an extra object of static storage duration to be implicitly zero
initialized).
The same reasoning applies to any structures provided by third-party libraries
which must be allocated by the calling application and zero-initialized, but
whose definitions are intended to be considered as opaque.
To fix the issue, GCC should simply special-case {0} as always-valid and
suppress warnings for it, while leaving in effect all other behaviors of
-Wbraces.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wbraces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
@ 2012-04-25 17:53 ` manu at gcc dot gnu.org
2012-04-25 18:02 ` [Bug c/53119] -Wmissing-braces " bugdal at aerifal dot cx
` (21 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-25 17:53 UTC (permalink / raw)
To: gcc-bugs
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 |WAITING
Last reconfirmed| |2012-04-25
CC| |manu at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-25 17:53:25 UTC ---
Where did you get your compiler?
-Wbraces is not a valid option in the original GCC.
http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning-Options
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
2012-04-25 17:53 ` [Bug c/53119] " manu at gcc dot gnu.org
@ 2012-04-25 18:02 ` bugdal at aerifal dot cx
2012-04-25 18:13 ` manu at gcc dot gnu.org
` (20 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: bugdal at aerifal dot cx @ 2012-04-25 18:02 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
2012-04-25 17:53 ` [Bug c/53119] " manu at gcc dot gnu.org
2012-04-25 18:02 ` [Bug c/53119] -Wmissing-braces " bugdal at aerifal dot cx
@ 2012-04-25 18:13 ` manu at gcc dot gnu.org
2012-04-25 18:32 ` bugdal at aerifal dot cx
` (19 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-25 18:13 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (2 preceding siblings ...)
2012-04-25 18:13 ` manu at gcc dot gnu.org
@ 2012-04-25 18:32 ` bugdal at aerifal dot cx
2012-04-25 22:13 ` manu at gcc dot gnu.org
` (18 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: bugdal at aerifal dot cx @ 2012-04-25 18:32 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (3 preceding siblings ...)
2012-04-25 18:32 ` bugdal at aerifal dot cx
@ 2012-04-25 22:13 ` manu at gcc dot gnu.org
2012-04-26 10:37 ` joseph at codesourcery dot com
` (17 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-25 22:13 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (4 preceding siblings ...)
2012-04-25 22:13 ` manu at gcc dot gnu.org
@ 2012-04-26 10:37 ` joseph at codesourcery dot com
2012-04-26 10:46 ` manu at gcc dot gnu.org
` (16 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: joseph at codesourcery dot com @ 2012-04-26 10:37 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (5 preceding siblings ...)
2012-04-26 10:37 ` joseph at codesourcery dot com
@ 2012-04-26 10:46 ` manu at gcc dot gnu.org
2012-04-26 10:51 ` joseph at codesourcery dot com
` (15 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-26 10:46 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (6 preceding siblings ...)
2012-04-26 10:46 ` manu at gcc dot gnu.org
@ 2012-04-26 10:51 ` joseph at codesourcery dot com
2012-05-03 17:55 ` manu at gcc dot gnu.org
` (14 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: joseph at codesourcery dot com @ 2012-04-26 10:51 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (7 preceding siblings ...)
2012-04-26 10:51 ` joseph at codesourcery dot com
@ 2012-05-03 17:55 ` manu at gcc dot gnu.org
2013-08-14 11:36 ` jnahughes at googlemail dot com
` (13 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: manu at gcc dot gnu.org @ 2012-05-03 17:55 UTC (permalink / raw)
To: gcc-bugs
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!
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (8 preceding siblings ...)
2012-05-03 17:55 ` manu at gcc dot gnu.org
@ 2013-08-14 11:36 ` jnahughes at googlemail dot com
2013-09-07 18:15 ` manu at gcc dot gnu.org
` (12 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: jnahughes at googlemail dot com @ 2013-08-14 11:36 UTC (permalink / raw)
To: gcc-bugs
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?
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (9 preceding siblings ...)
2013-08-14 11:36 ` jnahughes at googlemail dot com
@ 2013-09-07 18:15 ` manu at gcc dot gnu.org
2014-06-05 19:36 ` law at gcc dot gnu.org
` (11 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: manu at gcc dot gnu.org @ 2013-09-07 18:15 UTC (permalink / raw)
To: gcc-bugs
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?
>From gcc-bugs-return-429224-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Sep 07 19:28:06 2013
Return-Path: <gcc-bugs-return-429224-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 23526 invoked by alias); 7 Sep 2013 19:28:05 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 23499 invoked by uid 48); 7 Sep 2013 19:28:02 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58336] internal compiler error when using a static int for the size of a char array within a class
Date: Sat, 07 Sep 2013 19:28:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.7.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_known_to_work resolution
Message-ID: <bug-58336-4-eUGmUnLaQD@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58336-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58336-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-09/txt/msg00464.txt.bz2
Content-length: 505
http://gcc.gnu.org/bugzilla/show_bug.cgi?idX336
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Known to work| |4.7.3, 4.8.0, 4.9.0
Resolution|--- |FIXED
--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Thanks.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (10 preceding siblings ...)
2013-09-07 18:15 ` manu at gcc dot gnu.org
@ 2014-06-05 19:36 ` law at gcc dot gnu.org
2014-06-06 0:57 ` bugdal at aerifal dot cx
` (10 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: law at gcc dot gnu.org @ 2014-06-05 19:36 UTC (permalink / raw)
To: gcc-bugs
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=211289&root=gcc&view=rev
Log:
2014-06-05 S. Gilles <sgilles@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
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (11 preceding siblings ...)
2014-06-05 19:36 ` law at gcc dot gnu.org
@ 2014-06-06 0:57 ` bugdal at aerifal dot cx
2014-06-06 5:01 ` mpolacek at gcc dot gnu.org
` (9 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: bugdal at aerifal dot cx @ 2014-06-06 0:57 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (12 preceding siblings ...)
2014-06-06 0:57 ` bugdal at aerifal dot cx
@ 2014-06-06 5:01 ` mpolacek at gcc dot gnu.org
2014-08-03 17:40 ` rose.garcia-eggl2fk at yopmail dot com
` (8 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-06-06 5:01 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (13 preceding siblings ...)
2014-06-06 5:01 ` mpolacek at gcc dot gnu.org
@ 2014-08-03 17:40 ` rose.garcia-eggl2fk at yopmail dot com
2014-08-03 17:58 ` mpolacek at gcc dot gnu.org
` (7 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: rose.garcia-eggl2fk at yopmail dot com @ 2014-08-03 17:40 UTC (permalink / raw)
To: gcc-bugs
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=33228&action=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.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (14 preceding siblings ...)
2014-08-03 17:40 ` rose.garcia-eggl2fk at yopmail dot com
@ 2014-08-03 17:58 ` mpolacek at gcc dot gnu.org
2014-08-03 19:33 ` rose.garcia-eggl2fk at yopmail dot com
` (6 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-08-03 17:58 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (15 preceding siblings ...)
2014-08-03 17:58 ` mpolacek at gcc dot gnu.org
@ 2014-08-03 19:33 ` rose.garcia-eggl2fk at yopmail dot com
2015-01-21 18:57 ` rogerdpack at gmail dot com
` (5 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: rose.garcia-eggl2fk at yopmail dot com @ 2014-08-03 19:33 UTC (permalink / raw)
To: gcc-bugs
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=33229&action=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()).
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (16 preceding siblings ...)
2014-08-03 19:33 ` rose.garcia-eggl2fk at yopmail dot com
@ 2015-01-21 18:57 ` rogerdpack at gmail dot com
2015-01-21 19:29 ` mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: rogerdpack at gmail dot com @ 2015-01-21 18:57 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (17 preceding siblings ...)
2015-01-21 18:57 ` rogerdpack at gmail dot com
@ 2015-01-21 19:29 ` mpolacek at gcc dot gnu.org
2015-02-07 0:24 ` safinaskar at mail dot ru
` (3 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-01-21 19:29 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (18 preceding siblings ...)
2015-01-21 19:29 ` mpolacek at gcc dot gnu.org
@ 2015-02-07 0:24 ` safinaskar at mail dot ru
2015-02-07 0:31 ` bugdal at aerifal dot cx
` (2 subsequent siblings)
22 siblings, 0 replies; 24+ messages in thread
From: safinaskar at mail dot ru @ 2015-02-07 0:24 UTC (permalink / raw)
To: gcc-bugs
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)
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (19 preceding siblings ...)
2015-02-07 0:24 ` safinaskar at mail dot ru
@ 2015-02-07 0:31 ` bugdal at aerifal dot cx
2015-02-07 1:02 ` safinaskar at mail dot ru
2015-03-16 4:32 ` nightstrike at gmail dot com
22 siblings, 0 replies; 24+ messages in thread
From: bugdal at aerifal dot cx @ 2015-02-07 0:31 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (20 preceding siblings ...)
2015-02-07 0:31 ` bugdal at aerifal dot cx
@ 2015-02-07 1:02 ` safinaskar at mail dot ru
2015-03-16 4:32 ` nightstrike at gmail dot com
22 siblings, 0 replies; 24+ messages in thread
From: safinaskar at mail dot ru @ 2015-02-07 1:02 UTC (permalink / raw)
To: gcc-bugs
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)
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Bug c/53119] -Wmissing-braces wrongly warns about universal zero initializer {0}
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
` (21 preceding siblings ...)
2015-02-07 1:02 ` safinaskar at mail dot ru
@ 2015-03-16 4:32 ` nightstrike at gmail dot com
22 siblings, 0 replies; 24+ messages in thread
From: nightstrike at gmail dot com @ 2015-03-16 4:32 UTC (permalink / raw)
To: gcc-bugs
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)?
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2015-03-16 4:32 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-25 17:04 [Bug c/53119] New: -Wbraces wrongly warns about universal zero initializer {0} bugdal at aerifal dot cx
2012-04-25 17:53 ` [Bug c/53119] " manu at gcc dot gnu.org
2012-04-25 18:02 ` [Bug c/53119] -Wmissing-braces " bugdal at aerifal dot cx
2012-04-25 18:13 ` manu at gcc dot gnu.org
2012-04-25 18:32 ` bugdal at aerifal dot cx
2012-04-25 22:13 ` manu at gcc dot gnu.org
2012-04-26 10:37 ` joseph at codesourcery dot com
2012-04-26 10:46 ` manu at gcc dot gnu.org
2012-04-26 10:51 ` joseph at codesourcery dot com
2012-05-03 17:55 ` manu at gcc dot gnu.org
2013-08-14 11:36 ` jnahughes at googlemail dot com
2013-09-07 18:15 ` manu at gcc dot gnu.org
2014-06-05 19:36 ` law at gcc dot gnu.org
2014-06-06 0:57 ` bugdal at aerifal dot cx
2014-06-06 5:01 ` mpolacek at gcc dot gnu.org
2014-08-03 17:40 ` rose.garcia-eggl2fk at yopmail dot com
2014-08-03 17:58 ` mpolacek at gcc dot gnu.org
2014-08-03 19:33 ` rose.garcia-eggl2fk at yopmail dot com
2015-01-21 18:57 ` rogerdpack at gmail dot com
2015-01-21 19:29 ` mpolacek at gcc dot gnu.org
2015-02-07 0:24 ` safinaskar at mail dot ru
2015-02-07 0:31 ` bugdal at aerifal dot cx
2015-02-07 1:02 ` safinaskar at mail dot ru
2015-03-16 4:32 ` nightstrike at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).