------- Comment #23 from hjl dot tools at gmail dot com 2009-04-08 23:41 ------- This looks like an ABI issue:
[...@gnu-6 pr39678]$ cat pr39678.c #include <stdio.h> struct Y {}; struct X { struct Y y; __complex__ float val; }; struct X __attribute__((noinline)) foo (float *p) { struct X x; __real x.val = p[0]; __imag x.val = p[1]; return x; } #ifdef __cplusplus extern "C" #endif void abort (void); float a[2] = { 3., -2. }; int main() { struct X x = foo(a); printf ("X: %d\n", (int) sizeof (struct X)); printf ("Y: %d\n", (int) sizeof (struct Y)); if (__real x.val != 3.) abort (); if (__imag x.val != -2.) abort (); return 0; } [...@gnu-6 pr39678]$ gcc pr39678.c [...@gnu-6 pr39678]$ ./a.out X: 8 Y: 0 [...@gnu-6 pr39678]$ g++ pr39678.c [...@gnu-6 pr39678]$ ./a.out X: 12 Y: 1 Aborted [...@gnu-6 pr39678]$ "struct Y {};" isn't handled properly in C++. -- hjl dot tools at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jh at suse dot cz Summary|std::transform is incorrect |C++ empty struct is passed |with std::multiples and |incorrectly |bind2nd for complex<float> | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39678