public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
@ 2007-02-09 18:44 ` pinskia at gcc dot gnu dot org
  2008-11-05 17:20 ` josh at freedesktop dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-09 18:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2007-02-09 18:43 -------
*** Bug 30737 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |acahalan at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
  2007-02-09 18:44 ` [Bug c/10676] Using unnamed fields in initializers pinskia at gcc dot gnu dot org
@ 2008-11-05 17:20 ` josh at freedesktop dot org
  2008-11-05 17:21 ` josh at freedesktop dot org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: josh at freedesktop dot org @ 2008-11-05 17:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from josh at freedesktop dot org  2008-11-05 17:19 -------
*** Bug 38019 has been marked as a duplicate of this bug. ***


-- 

josh at freedesktop dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |josh at freedesktop dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
  2007-02-09 18:44 ` [Bug c/10676] Using unnamed fields in initializers pinskia at gcc dot gnu dot org
  2008-11-05 17:20 ` josh at freedesktop dot org
@ 2008-11-05 17:21 ` josh at freedesktop dot org
  2008-11-05 17:23 ` josh at freedesktop dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: josh at freedesktop dot org @ 2008-11-05 17:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from josh at freedesktop dot org  2008-11-05 17:20 -------
Still happens with GCC 4.3.2:

$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.2 (Debian 4.3.2-1) 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2008-11-05 17:21 ` josh at freedesktop dot org
@ 2008-11-05 17:23 ` josh at freedesktop dot org
  2009-06-17 17:16 ` JonathanDBrandmeyer at eaton dot com
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: josh at freedesktop dot org @ 2008-11-05 17:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from josh at freedesktop dot org  2008-11-05 17:21 -------
How can I update the "last confirmed" date to today?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2008-11-05 17:23 ` josh at freedesktop dot org
@ 2009-06-17 17:16 ` JonathanDBrandmeyer at eaton dot com
  2009-07-06 19:31 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: JonathanDBrandmeyer at eaton dot com @ 2009-06-17 17:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from JonathanDBrandmeyer at eaton dot com  2009-06-17 17:16 -------
Similarly, I would like the following to work as an extension to the anonymous
union support:

Given a structure like:
     struct foo {
       int a;
       union {
         int b;
         float c;
       };
       int d;
     };

I want to initialize it with a statement like:
struct foo value_of_foo = { .a = 0, .b = 1, .d = 2 };

instead of what is currently required, with braces around the initialization of
'foo::b':
struct foo value_of_foo = { .a = 0, { .b = 1 }, .d = 2 };

This is a natural extension of the ability to access members 'b' and 'c'
without tagging their union type.


-- 

JonathanDBrandmeyer at eaton dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |JonathanDBrandmeyer at eaton
                   |                            |dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2009-06-17 17:16 ` JonathanDBrandmeyer at eaton dot com
@ 2009-07-06 19:31 ` pinskia at gcc dot gnu dot org
  2009-08-27 14:58 ` jan dot cornelis at gmail dot com
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-07-06 19:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2009-07-06 19:30 -------
*** Bug 40656 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xiaosuo at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2009-07-06 19:31 ` pinskia at gcc dot gnu dot org
@ 2009-08-27 14:58 ` jan dot cornelis at gmail dot com
  2010-01-26 16:26 ` mat at lcs dot mit dot edu
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: jan dot cornelis at gmail dot com @ 2009-08-27 14:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jan dot cornelis at gmail dot com  2009-08-27 14:57 -------
An example program that shows 3 different methods. Only one works (see comment) 
As I used the names for each field, I assumed that all 3 examples should work. 

#include <inttypes.h>
#include <stdio.h>

struct a_t {
  uint16_t a;
  uint16_t b;
  union {
      uint8_t c;
    uint16_t d;
  };
};

#if (1)
struct a_t alfa = {
  .a = 1,
  .b = 2,
  .c = 3, //Will not work
};
#elif (0)
struct a_t alfa = {
  .a = 1,
  .b = 2,
  {.c = 3}, //works
};
#elif (0)
struct a_t alfa = {
  .a = 1,
  {.c= 2}, //Does not work
  .b = 3,
}
#endif

int main(void)
{
  //alfa.c = 4;
  //alfa.d = 5;
  printf("%20s:%d\n","alfa.a",alfa.a);
  printf("%20s:%d\n","alfa.b",alfa.b);
  printf("%20s:%d\n","alfa.c",alfa.c);
  printf("%20s:%d\n","alfa.d",alfa.d);
 return 0; 
}


-- 

jan dot cornelis at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan dot cornelis at gmail
                   |                            |dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2009-08-27 14:58 ` jan dot cornelis at gmail dot com
@ 2010-01-26 16:26 ` mat at lcs dot mit dot edu
  2010-01-26 16:29 ` mat at lcs dot mit dot edu
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: mat at lcs dot mit dot edu @ 2010-01-26 16:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from mat at lcs dot mit dot edu  2010-01-26 16:25 -------
*** Bug 42875 has been marked as a duplicate of this bug. ***


-- 

mat at lcs dot mit dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mat at lcs dot mit dot edu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2010-01-26 16:26 ` mat at lcs dot mit dot edu
@ 2010-01-26 16:29 ` mat at lcs dot mit dot edu
  2010-01-26 16:32 ` jsm28 at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: mat at lcs dot mit dot edu @ 2010-01-26 16:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from mat at lcs dot mit dot edu  2010-01-26 16:28 -------
This "bug" is causing me difficulty porting from an EDG-based compiler to
gcc-4.4.3.  EDG implemented "assignment" and "initialization" as having the
same namespace.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2010-01-26 16:29 ` mat at lcs dot mit dot edu
@ 2010-01-26 16:32 ` jsm28 at gcc dot gnu dot org
  2010-05-09 20:40 ` jsm28 at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2010-01-26 16:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from jsm28 at gcc dot gnu dot org  2010-01-26 16:32 -------
C1x anonymous structures and unions will likely require a fix for this.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2010-01-26 16:32 ` jsm28 at gcc dot gnu dot org
@ 2010-05-09 20:40 ` jsm28 at gcc dot gnu dot org
  2010-05-09 20:42 ` jsm28 at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 19+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2010-05-09 20:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from jsm28 at gcc dot gnu dot org  2010-05-09 20:39 -------
Subject: Bug 10676

Author: jsm28
Date: Sun May  9 20:39:39 2010
New Revision: 159206

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159206
Log:
        PR c/10676
        * c-typeck.c (lookup_field): Take a type directly.  Update
        recursive calls.
        (build_component_ref): Update call to lookup_field.
        (set_init_label): Use lookup_field to find initialized field.
        Handle returned list of fields like a sequence of designators.

testsuite:
        * gcc.dg/anon-struct-10.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/anon-struct-10.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2010-05-09 20:40 ` jsm28 at gcc dot gnu dot org
@ 2010-05-09 20:42 ` jsm28 at gcc dot gnu dot org
  2010-05-09 21:00 ` davek at gcc dot gnu dot org
  2010-05-15  3:23 ` balrogg at gmail dot com
  13 siblings, 0 replies; 19+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2010-05-09 20:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from jsm28 at gcc dot gnu dot org  2010-05-09 20:42 -------
Fixed for 4.6.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.5.0 4.6.0                 |4.5.0
      Known to work|                            |4.6.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2010-05-09 20:42 ` jsm28 at gcc dot gnu dot org
@ 2010-05-09 21:00 ` davek at gcc dot gnu dot org
  2010-05-15  3:23 ` balrogg at gmail dot com
  13 siblings, 0 replies; 19+ messages in thread
From: davek at gcc dot gnu dot org @ 2010-05-09 21:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from davek at gcc dot gnu dot org  2010-05-09 21:00 -------
Thank you!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2010-05-09 21:00 ` davek at gcc dot gnu dot org
@ 2010-05-15  3:23 ` balrogg at gmail dot com
  13 siblings, 0 replies; 19+ messages in thread
From: balrogg at gmail dot com @ 2010-05-15  3:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from balrogg at gmail dot com  2010-05-15 03:23 -------
(In reply to comment #11)
> An example program that shows 3 different methods. Only one works (see comment) 
>   .c = 3, //Will not work
>   {.c = 3}, //works
>   {.c= 2}, //Does not work

For sake of documentation, with versions from before the fix the second method
did not always work.  It seems to depend also on the ordering of the members in
the anonymous union.  If .c is the first, second or third member of the union
it seems to work.  It does not work for the fourth and following members. 
Really puzzling.


-- 

balrogg at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |balrogg at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <20030508022600.10676.marcus@gnu.org>
                   ` (3 preceding siblings ...)
  2005-02-15 22:24 ` jrydberg at gnu dot org
@ 2005-09-26 12:15 ` jsm28 at gcc dot gnu dot org
  4 siblings, 0 replies; 19+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-09-26 12:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm28 at gcc dot gnu dot org  2005-09-26 12:15 -------
*** Bug 24065 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |benoit dot guerin at thomson
                   |                            |dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <20030508022600.10676.marcus@gnu.org>
                   ` (2 preceding siblings ...)
  2004-09-24 22:37 ` jsm28 at gcc dot gnu dot org
@ 2005-02-15 22:24 ` jrydberg at gnu dot org
  2005-09-26 12:15 ` jsm28 at gcc dot gnu dot org
  4 siblings, 0 replies; 19+ messages in thread
From: jrydberg at gnu dot org @ 2005-02-15 22:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jrydberg at gnu dot org  2005-02-15 18:30 -------
Still happens on 4.0 snapshot of 20050213 :

$ /gnu/bin/gcc -c pr10676.c
pr10676.c:9: error: unknown field 'foo' specified in initializer
$ /gnu/bin/gcc -v
...
gcc version 4.0.0 20050213 (experimental)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <20030508022600.10676.marcus@gnu.org>
  2003-08-22  2:38 ` pinskia at gcc dot gnu dot org
  2004-02-10 11:16 ` pinskia at gcc dot gnu dot org
@ 2004-09-24 22:37 ` jsm28 at gcc dot gnu dot org
  2005-02-15 22:24 ` jrydberg at gnu dot org
  2005-09-26 12:15 ` jsm28 at gcc dot gnu dot org
  4 siblings, 0 replies; 19+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2004-09-24 22:37 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |minor


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <20030508022600.10676.marcus@gnu.org>
  2003-08-22  2:38 ` pinskia at gcc dot gnu dot org
@ 2004-02-10 11:16 ` pinskia at gcc dot gnu dot org
  2004-09-24 22:37 ` jsm28 at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-02-10 11:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-02-10 11:16 -------
*** Bug 14094 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roart at nvg dot ntnu dot no


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


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

* [Bug c/10676] Using unnamed fields in initializers
       [not found] <20030508022600.10676.marcus@gnu.org>
@ 2003-08-22  2:38 ` pinskia at gcc dot gnu dot org
  2004-02-10 11:16 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-22  2:38 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
   Last reconfirmed|2003-05-31 14:12:18         |2003-08-22 02:38:50
               date|                            |


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

end of thread, other threads:[~2010-05-15  3:23 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-10676-1375@http.gcc.gnu.org/bugzilla/>
2007-02-09 18:44 ` [Bug c/10676] Using unnamed fields in initializers pinskia at gcc dot gnu dot org
2008-11-05 17:20 ` josh at freedesktop dot org
2008-11-05 17:21 ` josh at freedesktop dot org
2008-11-05 17:23 ` josh at freedesktop dot org
2009-06-17 17:16 ` JonathanDBrandmeyer at eaton dot com
2009-07-06 19:31 ` pinskia at gcc dot gnu dot org
2009-08-27 14:58 ` jan dot cornelis at gmail dot com
2010-01-26 16:26 ` mat at lcs dot mit dot edu
2010-01-26 16:29 ` mat at lcs dot mit dot edu
2010-01-26 16:32 ` jsm28 at gcc dot gnu dot org
2010-05-09 20:40 ` jsm28 at gcc dot gnu dot org
2010-05-09 20:42 ` jsm28 at gcc dot gnu dot org
2010-05-09 21:00 ` davek at gcc dot gnu dot org
2010-05-15  3:23 ` balrogg at gmail dot com
     [not found] <20030508022600.10676.marcus@gnu.org>
2003-08-22  2:38 ` pinskia at gcc dot gnu dot org
2004-02-10 11:16 ` pinskia at gcc dot gnu dot org
2004-09-24 22:37 ` jsm28 at gcc dot gnu dot org
2005-02-15 22:24 ` jrydberg at gnu dot org
2005-09-26 12:15 ` jsm28 at gcc dot gnu dot 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).