[Bug c/16330] New: Unions handled incorrectly with -fshort-enums

miko at stacken dot kth dot se gcc-bugzilla@gcc.gnu.org
Fri Jul 2 16:38:00 GMT 2004


The following code correctly prints 1 when compiled without -fshort-enums, but 
incorrectly prints a 0 when compiled with -fshort-enums. I assume this is an
endian problem as it works correctly on a i686-pc-linux-gnu target.


#include <stdio.h>

enum E { a, b };

union Y
{
  int x;
  enum E   y;
  void* z;
};

int main()
{
  union Y un;
  un.x=1;
  printf("%d\n", un.y);
}

-- 
           Summary: Unions handled incorrectly with -fshort-enums
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: miko at stacken dot kth dot se
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris
  GCC host triplet: sparc-sun-solaris
GCC target triplet: sparc-sun-solaris


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



More information about the Gcc-bugs mailing list