http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53663
Bug #: 53663 Summary: 4.7 inconsistent inline handling of bool within union Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: brendan.jones...@gmail.com Please refer to the following: /* -*- Mode: C ; c-basic-offset: 4 -*- */ /* gcc test_jack.c -Wall -Wextra -o test -O1 && ./test ; echo $? should print 0, prints 10 gcc known to be affected: Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --disable-build-with-cxx --disable-build-poststage1-with-cxx --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.7.0 20120507 (Red Hat 4.7.0-5) (GCC) */ #include <stdio.h> union u { int i = 0; _Bool b = 0; }; void f(union u * vp, union u v) { *vp = v; } int main() { union u v = 0; union u v1 = 0; union u v2 = 0; v.i = 10; f(&v1, v); v.b = 0; f(&v2, v); if (v2.b) printf("True\n"); else printf("False\n"); return v2.b; }