https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61976
Bug ID: 61976
Summary: aix64: Data corruption in struct passed by value
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lbl2007 at gmx dot net
Test program:
#include <stdio.h>
struct Demo { float a; };
void foo( const Demo byval, const Demo &byref )
{
printf( "byval: %f\n", (double) byval.a );
printf( "byref: %f\n", (double) byref.a );
}
int main()
{
Demo a = { 1.23 };
foo( a, a );
return 0;
}
When I compile and run this under AIX, the first argument is corrupted:
g++ -maix64 -o demo demo.c
./demo
byval: -0.000000
byref: 1.230000
The problem does not occur with -maix32
GCC version:
Target: powerpc-ibm-aix6.1.0.0
Configured with: /common/mringe/gcc47_alt/gcc-4.7.2/configure
--prefix=/common/mringe/gcc47_alt/local --with-as=/usr/bin/as
--with-ld=/usr/bin/ld --enable-languages=c,c++ --enable-threads --disable-nls
--disable-shared --with-gmp=/common/mringe/gcc47_alt/local
--with-mpfr=/common/mringe/gcc47_alt/local
--with-mpc=/common/mringe/gcc47_alt/local
Thread model: aix
gcc version 4.7.2 (GCC)