public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug testsuite/63211] New: gcc.target/i386/avx2-*.c tests use broken type-punning
Date: Tue, 09 Sep 2014 08:49:00 -0000	[thread overview]
Message-ID: <bug-63211-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63211

            Bug ID: 63211
           Summary: gcc.target/i386/avx2-*.c tests use broken type-punning
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
            Target: x86_64-*-*, i?86-*-*

For example gcc.target/i386/avx2-vpblendd128-2.c does

static void
init_pblendd128 (int *src1, int *src2, int seed)
{
  int i, sign = 1;

  for (i = 0; i < 4; i++)
    {
      src1[i] = (i + seed) * (i + seed) * sign;
      src2[i] = (i + seed + 20) * sign;
      sign = -sign;
    }
}
...
static void
avx2_test (void)
{
  union128i_d src1, src2, dst;
  int dst_ref[4];
  int i;

  for (i = 0; i < NUM; i++)
    {
      init_pblendd128 (src1.a, src2.a, i);

      dst.x = _mm_blend_epi32 (src1.x, src2.x, MASK);

which stores to src1.a/src2.a via a pointer and not a direct union access.

This makes us optimize away the init_pblendd128 function after it being
inlined.

FAIL: gcc.target/i386/avx2-vpblendd128-2.c execution test
FAIL: gcc.target/i386/avx2-vpblendd256-2.c execution test
FAIL: gcc.target/i386/avx2-vpblendw-2.c execution test
FAIL: gcc.target/i386/avx2-vpbroadcastd128-2.c execution test
FAIL: gcc.target/i386/avx2-vpbroadcastd256-2.c execution test
FAIL: gcc.target/i386/avx2-vpbroadcastw128-2.c execution test
FAIL: gcc.target/i386/avx2-vpbroadcastw256-2.c execution test
FAIL: gcc.target/i386/avx2-vpermd-2.c execution test
FAIL: gcc.target/i386/avx2-vpermps-2.c execution test
FAIL: gcc.target/i386/avx2-vpmaxsd-2.c execution test
FAIL: gcc.target/i386/avx2-vpmaxsw-2.c execution test
FAIL: gcc.target/i386/avx2-vpmaxud-2.c execution test
FAIL: gcc.target/i386/avx2-vpmaxuw-2.c execution test
FAIL: gcc.target/i386/avx2-vpminsd-2.c execution test
FAIL: gcc.target/i386/avx2-vpminsw-2.c execution test
FAIL: gcc.target/i386/avx2-vpminud-2.c execution test
FAIL: gcc.target/i386/avx2-vpminuw-2.c execution test
FAIL: gcc.target/i386/avx2-vpmuldq-2.c execution test
FAIL: gcc.target/i386/avx2-vpmulhrsw-2.c execution test
FAIL: gcc.target/i386/avx2-vpmulhuw-2.c execution test
FAIL: gcc.target/i386/avx2-vpmulhw-2.c execution test
FAIL: gcc.target/i386/avx2-vpmulld-2.c execution test
FAIL: gcc.target/i386/avx2-vpmullw-2.c execution test
FAIL: gcc.target/i386/avx2-vpmuludq-2.c execution test
FAIL: gcc.target/i386/avx2-vpshufd-2.c execution test
FAIL: gcc.target/i386/avx2-vpshufhw-2.c execution test
FAIL: gcc.target/i386/avx2-vpshuflw-2.c execution test
FAIL: gcc.target/i386/avx2-vpsignd-2.c execution test
FAIL: gcc.target/i386/avx2-vpsignw-2.c execution test
FAIL: gcc.target/i386/avx2-vpslld-2.c execution test
FAIL: gcc.target/i386/avx2-vpsllvd128-2.c execution test
FAIL: gcc.target/i386/avx2-vpsllvd256-2.c execution test
FAIL: gcc.target/i386/avx2-vpsllw-2.c execution test
FAIL: gcc.target/i386/avx2-vpsrad-2.c execution test
FAIL: gcc.target/i386/avx2-vpsravd128-2.c execution test
FAIL: gcc.target/i386/avx2-vpsravd256-2.c execution test
FAIL: gcc.target/i386/avx2-vpsraw-2.c execution test
FAIL: gcc.target/i386/avx2-vpsrld-2.c execution test
FAIL: gcc.target/i386/avx2-vpsrlvd128-2.c execution test
FAIL: gcc.target/i386/avx2-vpsrlvd256-2.c execution test
FAIL: gcc.target/i386/avx2-vpsrlw-2.c execution test
FAIL: gcc.target/i386/avx2-vpunpckhdq-2.c execution test
FAIL: gcc.target/i386/avx2-vpunpckhwd-2.c execution test
FAIL: gcc.target/i386/avx2-vpunpckldq-2.c execution test
FAIL: gcc.target/i386/avx2-vpunpcklwd-2.c execution test

the actual miscompile only happens if you apply the fix for PR40135, the
testcases are broken nevertheless according to how type-punning through
unions is supposed to work.


             reply	other threads:[~2014-09-09  8:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09  8:49 rguenth at gcc dot gnu.org [this message]
2014-10-31 11:28 ` [Bug testsuite/63211] " ubizjak at gmail dot com
2014-11-05 19:05 ` kyukhin at gcc dot gnu.org
2021-08-28 19:10 ` pinskia 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-63211-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).