This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/16330] New: Unions handled incorrectly with -fshort-enums
- From: "miko at stacken dot kth dot se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Jul 2004 16:38:52 -0000
- Subject: [Bug c/16330] New: Unions handled incorrectly with -fshort-enums
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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