This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/18916] New: vector code is generated to copy data to mis-aligned memory (-mcpu=G5)
- From: "fjahanian at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Dec 2004 01:08:28 -0000
- Subject: [Bug target/18916] New: vector code is generated to copy data to mis-aligned memory (-mcpu=G5)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Following test case, compiled with -mcpu=G5, aborts.
It aborts because in passing the 32-byte argument (g1sScld1) to testvaScld1 routine
gcc allocates a temporary on the stack for the purpose of storing
g1sScld1 and then loading it into GPRs. Recently, rs6000.c
was modified in routine expand_block_move to do lvx/stvx when alignment
of src and destination are 128 bits. But in the case of temporaries allocated
on the stack, target alignment is not correct. It is true that we set the MEM_ALIGN
of target temporary to 128 bit, but it comes from the alignment of the source
which is a user variable and has the 128 bit alignment.
So, in the given test case, routine expand_block_move generates
stvx to temporary stack location which is misaligned and bad things happen.
extern void abort (void);
typedef __builtin_va_list __gnuc_va_list;
typedef __gnuc_va_list va_list;
typedef struct { _Complex long double a; } Scld1;
void testvaScld1 (int n, ...)
{
va_list ap;
__builtin_va_start(ap,n);
Scld1 t = __builtin_va_arg(ap,Scld1);
if (t.a != (_Complex long double)1)
abort();
__builtin_va_end(ap);
}
int main ()
{
Scld1 g1sScld1;
g1sScld1.a = (_Complex long double)1;
testvaScld1 (1, g1sScld1);
return 0;
}
--
Summary: vector code is generated to copy data to mis-aligned
memory (-mcpu=G5)
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fjahanian at apple dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: apple-ppc-darwin
GCC host triplet: apple-ppc-darwin
GCC target triplet: apple-ppc-darwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18916