[Bug c/60017] New: Struct not returned correctly
ishiura-compiler at ml dot kwansei.ac.jp
gcc-bugzilla@gcc.gnu.org
Sat Feb 1 03:52:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60017
Bug ID: 60017
Summary: Struct not returned correctly
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: ishiura-compiler at ml dot kwansei.ac.jp
GCC 4.9.0 for x86_64 miscompiles the following code.
$ cat error.c
struct S0 { short m0; short m1; };
struct S1 { unsigned m0 : 1; char m1[2][2]; struct S0 m2[2]; };
struct S1 x = {1,{{1,1},{1,1}},{{1,1},{1,1}}};
struct S1 func(void) { return x; }
int main(void)
{
struct S1 ret = func();
if( ret.m2[1].m1 != 1 ) { __builtin_abort(); }
return 0;
}
$ gcc-4.9 error.c
$ ./a.out
Abort trap: 6
The value of ret.m2[1].m1 was 32767 instead of 1.
There was no problem with an i686 target.
$ gcc-4.9 -v
Using built-in specs.
COLLECT_GCC=gcc-4.9
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc49/4.9-20140126/gcc/libexec/gcc/x86_64-apple-darwin13.0.0/4.9.0/lto-wrapper
Target: x86_64-apple-darwin13.0.0
Configured with: ../configure --build=x86_64-apple-darwin13.0.0
--prefix=/usr/local/Cellar/gcc49/4.9-20140126/gcc
--datarootdir=/usr/local/Cellar/gcc49/4.9-20140126/share
--bindir=/usr/local/Cellar/gcc49/4.9-20140126/bin --enable-languages=c
--program-suffix=-4.9 --with-gmp=/usr/local/opt/gmp
--with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc
--with-cloog=/usr/local/opt/cloog --with-isl=/usr/local/opt/isl
--with-system-zlib --enable-libstdcxx-time=yes --enable-stage1-checking
--enable-checking=release --enable-plugin --enable-lto --disable-werror
--disable-nls --disable-multilib --with-native-system-header-dir=/usr/include
--with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
Thread model: posix
gcc version 4.9.0 20140126 (experimental) (GCC)
More information about the Gcc-bugs
mailing list