public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/18916] New: vector code is generated to copy data to mis-aligned memory (-mcpu=G5)
@ 2004-12-10  1:08 fjahanian at apple dot com
  2004-12-10  1:12 ` [Bug target/18916] " fjahanian at apple dot com
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: fjahanian at apple dot com @ 2004-12-10  1:08 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2005-01-11 10:03 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-10  1:08 [Bug target/18916] New: vector code is generated to copy data to mis-aligned memory (-mcpu=G5) fjahanian at apple dot com
2004-12-10  1:12 ` [Bug target/18916] " fjahanian at apple dot com
2004-12-10  1:27 ` pinskia at gcc dot gnu dot org
2004-12-10  1:42 ` fjahanian at apple dot com
2004-12-10  3:21 ` dje at gcc dot gnu dot org
2004-12-10  3:35 ` [Bug target/18916] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-12-10  3:35 ` [Bug target/18916] " pinskia at gcc dot gnu dot org
2004-12-14  1:48 ` [Bug target/18916] [4.0 Regression] vector code is generated to copy data to mis-aligned memory (-maltivec) pinskia at gcc dot gnu dot org
2004-12-18  0:43 ` [Bug target/18916] [4.0 Regression] mis-aligned vector code with copy " fjahanian at apple dot com
2004-12-18  1:46 ` fjahanian at apple dot com
2004-12-21  1:25 ` fjahanian at apple dot com
2004-12-28 23:05 ` geoffk at gcc dot gnu dot org
2004-12-29 17:34 ` fjahanian at apple dot com
2004-12-31 23:15 ` amodra at bigpond dot net dot au
2005-01-01  7:17 ` amodra at bigpond dot net dot au
2005-01-07 23:39 ` amodra at bigpond dot net dot au
2005-01-11  9:52 ` cvs-commit at gcc dot gnu dot org
2005-01-11 10:03 ` amodra at bigpond dot net dot au

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).