This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/12775] New: Nested transparent unions regression


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

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

           Summary: Nested transparent unions regression
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steve at chelsio dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: all

The following code:

 - - - 8< - - -

#include <stdio.h>

union optid {
    unsigned int opcode_tid;
    struct {
        unsigned int opcode:8;
        unsigned int tid:24; 
    };
};

struct cpl_msg {
    union optid;
    int item1;
};

int main() {
    struct cpl_msg x;
    int opcode;
    int tid;

    x.opcode_tid = 0x000102da;

    printf("opcode %x tid %x\n", x.opcode, x.tid);

    exit(0);
}


 - - - >8 - - -

compiles and works with GCC 2.96 (ugh) and 3.2.2[FreeBSD] 20030205,
but with 3.4-20030819 (experimental), it fails during compilation:

     tpun.c:12: warning: declaration does not declare anything
     tpun.c: In function `main':

     tpun.c:21: error: structure has no member named `opcode_tid'
     tpun.c:23: error: structure has no member named `opcode'
     tpun.c:23: error: structure has no member named `tid'

I don't have a 3.3 handy to try it with, though.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]