public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/64480] New: List designated initializer triggers -Wmissing-field-initializers
@ 2015-01-03 15:27 petr.pisar at atlas dot cz
  2015-01-05 15:26 ` [Bug c/64480] " joseph at codesourcery dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: petr.pisar at atlas dot cz @ 2015-01-03 15:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64480
           Summary: List designated initializer triggers
                    -Wmissing-field-initializers
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: petr.pisar at atlas dot cz

This code:

struct lower {
    char *foo;
    char *bar;
};

struct upper {
    struct lower inner;
};

int main (void) {
    struct upper u = {
        /* This triggers -Wmissing-field-initializers warning */
        .inner.foo = "Foo",
        .inner.bar = "Bar",

        /* While this passes: 
        .inner = {
            .foo = "Foo",
            .bar = "Bar",
        },
        */
    };

    (void)u;

    return 0;
}


Triggers warning about initialized lower.bar field:

$ gcc -Wall -Wextra -std=c99 -O0 -g test.c
test.c: In function ‘main’:
test.c:14:9: warning: missing initializer for field ‘bar’ of ‘struct lower’
[-Wmissing-field-initializers]
         .inner.bar = "Bar",
         ^
test.c:3:11: note: ‘bar’ declared here
     char *bar;
           ^

If I change to initialization from the list form (.inner.foo=) to nested
(.inner={.foo=}), then it passes. The change is commented out in the quoted
code.

I think the list syntax is valid per C99, 6.7.9 Initialization grammar.
>From gcc-bugs-return-472115-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Jan 03 15:48:02 2015
Return-Path: <gcc-bugs-return-472115-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 21225 invoked by alias); 3 Jan 2015 15:48:02 -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 21084 invoked by uid 48); 3 Jan 2015 15:47:57 -0000
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/60255] [OOP] Deferred character length variable at (1) cannot yet be associated with unlimited polymorphic entities
Date: Sat, 03 Jan 2015 15:48:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: rejects-valid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: janus at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P4
X-Bugzilla-Assigned-To: vehre at gmx dot de
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: keywords bug_status assigned_to short_desc
Message-ID: <bug-60255-4-o8WgMQtiqr@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60255-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60255-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: 2015-01/txt/msg00109.txt.bz2
Content-length: 771

https://gcc.gnu.org/bugzilla/show_bug.cgi?id`255

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |vehre at gmx dot de
            Summary|[oop] Deferred character    |[OOP] Deferred character
                   |length variable at (1)      |length variable at (1)
                   |cannot yet be associated    |cannot yet be associated
                   |with unlimited polymorphic  |with unlimited polymorphic
                   |entities                    |entities


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/64480] List designated initializer triggers -Wmissing-field-initializers
  2015-01-03 15:27 [Bug c/64480] New: List designated initializer triggers -Wmissing-field-initializers petr.pisar at atlas dot cz
@ 2015-01-05 15:26 ` joseph at codesourcery dot com
  2015-01-05 15:30 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: joseph at codesourcery dot com @ 2015-01-05 15:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
I don't see this with trunk - maybe the same as bug 60784?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/64480] List designated initializer triggers -Wmissing-field-initializers
  2015-01-03 15:27 [Bug c/64480] New: List designated initializer triggers -Wmissing-field-initializers petr.pisar at atlas dot cz
  2015-01-05 15:26 ` [Bug c/64480] " joseph at codesourcery dot com
@ 2015-01-05 15:30 ` mpolacek at gcc dot gnu.org
  2015-09-18  9:44 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-01-05 15:30 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Yep, I bet it's the same bug.  I'm slightly nervous about backporting that fix
to 4.8/4.9 branches though.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/64480] List designated initializer triggers -Wmissing-field-initializers
  2015-01-03 15:27 [Bug c/64480] New: List designated initializer triggers -Wmissing-field-initializers petr.pisar at atlas dot cz
  2015-01-05 15:26 ` [Bug c/64480] " joseph at codesourcery dot com
  2015-01-05 15:30 ` mpolacek at gcc dot gnu.org
@ 2015-09-18  9:44 ` mpolacek at gcc dot gnu.org
  2023-04-06  8:48 ` zhonghao at pku dot org.cn
  2023-04-06  9:28 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-09-18  9:44 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This ought to be resolved for 5/6.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/64480] List designated initializer triggers -Wmissing-field-initializers
  2015-01-03 15:27 [Bug c/64480] New: List designated initializer triggers -Wmissing-field-initializers petr.pisar at atlas dot cz
                   ` (2 preceding siblings ...)
  2015-09-18  9:44 ` mpolacek at gcc dot gnu.org
@ 2023-04-06  8:48 ` zhonghao at pku dot org.cn
  2023-04-06  9:28 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: zhonghao at pku dot org.cn @ 2023-04-06  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

zhonghao at pku dot org.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zhonghao at pku dot org.cn

--- Comment #4 from zhonghao at pku dot org.cn ---
Is this bug fixed? I tried the latest gcc, but it still rejects the sample
code.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/64480] List designated initializer triggers -Wmissing-field-initializers
  2015-01-03 15:27 [Bug c/64480] New: List designated initializer triggers -Wmissing-field-initializers petr.pisar at atlas dot cz
                   ` (3 preceding siblings ...)
  2023-04-06  8:48 ` zhonghao at pku dot org.cn
@ 2023-04-06  9:28 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2023-04-06  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to zhonghao from comment #4)
> Is this bug fixed? I tried the latest gcc, but it still rejects the sample
> code.

No, the latest gcc accepts this C code without errors. Please stop commenting
on old bugs if you are not capable of understanding the difference between C
and C++, or I will block your account.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-04-06  9:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-03 15:27 [Bug c/64480] New: List designated initializer triggers -Wmissing-field-initializers petr.pisar at atlas dot cz
2015-01-05 15:26 ` [Bug c/64480] " joseph at codesourcery dot com
2015-01-05 15:30 ` mpolacek at gcc dot gnu.org
2015-09-18  9:44 ` mpolacek at gcc dot gnu.org
2023-04-06  8:48 ` zhonghao at pku dot org.cn
2023-04-06  9:28 ` redi at gcc dot gnu.org

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).