public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/94225] New: C18 conformance for structure implicit initialization
@ 2020-03-19 15:31 dje at gcc dot gnu.org
  2020-03-19 15:32 ` [Bug c/94225] " dje at gcc dot gnu.org
  2020-03-19 21:00 ` jsm28 at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: dje at gcc dot gnu.org @ 2020-03-19 15:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94225
           Summary: C18 conformance for structure implicit initialization
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dje at gcc dot gnu.org
  Target Milestone: ---

Example 12 in section 6.7.9 of the C18 standard demonstrates that implicit
initialization does not override prior explicit initialization.  The following
is the example code with error checking added.

$ cat example12.c
#include <stdio.h>

struct T {
  int k;
  int l;
};
struct S {
  int i;
  struct T t;
};

struct T x = {.l = 43, .k = 42, };
int main(void)
{
  struct S l = { 1, .t = x, .t.l = 41, };
  if (l.t.k != 42)
    fprintf(stderr, "l.t.k is %d instead of 42\n", l.t.k);
}

$ ./xgcc -B./ -std=gnu1x example12.c
$ ./a.out
l.t.k is 0 instead of 42
$

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

* [Bug c/94225] C18 conformance for structure implicit initialization
  2020-03-19 15:31 [Bug c/94225] New: C18 conformance for structure implicit initialization dje at gcc dot gnu.org
@ 2020-03-19 15:32 ` dje at gcc dot gnu.org
  2020-03-19 21:00 ` jsm28 at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: dje at gcc dot gnu.org @ 2020-03-19 15:32 UTC (permalink / raw)
  To: gcc-bugs

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

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu.org
   Last reconfirmed|                            |2020-03-19
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from David Edelsohn <dje at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c/94225] C18 conformance for structure implicit initialization
  2020-03-19 15:31 [Bug c/94225] New: C18 conformance for structure implicit initialization dje at gcc dot gnu.org
  2020-03-19 15:32 ` [Bug c/94225] " dje at gcc dot gnu.org
@ 2020-03-19 21:00 ` jsm28 at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2020-03-19 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #2 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Already filed in Bugzilla.

*** This bug has been marked as a duplicate of bug 63944 ***

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

end of thread, other threads:[~2020-03-19 21:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 15:31 [Bug c/94225] New: C18 conformance for structure implicit initialization dje at gcc dot gnu.org
2020-03-19 15:32 ` [Bug c/94225] " dje at gcc dot gnu.org
2020-03-19 21:00 ` jsm28 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).