public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bergner at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/52457] New: Wrong VSX code generation bug when compiled with -O1 -m32 -mcpu=power7
Date: Fri, 02 Mar 2012 01:57:00 -0000	[thread overview]
Message-ID: <bug-52457-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52457

             Bug #: 52457
           Summary: Wrong VSX code generation bug when compiled with -O1
                    -m32 -mcpu=power7
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: bergner@gcc.gnu.org
        ReportedBy: bergner@gcc.gnu.org
                CC: meissner@gcc.gnu.org
              Host: powerpc*-linux
            Target: powerpc*-linux
             Build: powerpc*-linux


The following test case aborts when compiled with -O1 and -O2, but runs
successfully when compiled with -O0 and -O3.  The wrong code generation occurs
in the function buggy_func().  The bug is caused by a typo in the
rs600/vsx.md's vsx_set_<mode> pattern.

bergner@igoo:~> cat bug.c 
extern void abort (void);

typedef long long T;
typedef T vl_t __attribute__((vector_size(2 * sizeof (T))));

vl_t
buggy_func (T x)
{
  vl_t w;
  T *p = (T *)&w;
  p[0] = p[1] = x;
  return w;
}

int
main(void)
{
  vl_t rval;
  T *pl;

  pl = (T *) &rval;
  rval = buggy_func (2);

  if (pl[0] != 2 || pl[1] != 2)
    abort ();

  return 0;
}
bergner@igoo:~> /home/bergner/gcc/build/gcc-mainline-testsuite/gcc/xgcc
-B/home/bergner/gcc/build/gcc-mainline-testsuite/gcc/ -O0 -m32 -mcpu=power7
bug.c 
bergner@igoo:~> ./a.out 
bergner@igoo:~> /home/bergner/gcc/build/gcc-mainline-testsuite/gcc/xgcc
-B/home/bergner/gcc/build/gcc-mainline-testsuite/gcc/ -O1 -m32 -mcpu=power7
bug.c 
bergner@igoo:~> ./a.out 
Aborted


             reply	other threads:[~2012-03-02  1:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02  1:57 bergner at gcc dot gnu.org [this message]
2012-03-02  2:00 ` [Bug target/52457] " bergner at gcc dot gnu.org
2012-03-02 10:01 ` rguenth at gcc dot gnu.org
2012-03-02 15:59 ` bergner at gcc dot gnu.org
2012-03-02 22:46 ` bergner at gcc dot gnu.org

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=bug-52457-4@http.gcc.gnu.org/bugzilla/ \
    --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).