public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fjahanian at apple dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/18916] New: vector code is generated to copy data to mis-aligned memory (-mcpu=G5)
Date: Fri, 10 Dec 2004 01:08:00 -0000	[thread overview]
Message-ID: <20041210010826.18916.fjahanian@apple.com> (raw)

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


             reply	other threads:[~2004-12-10  1:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-10  1:08 fjahanian at apple dot com [this message]
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 ` pinskia 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-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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041210010826.18916.fjahanian@apple.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).