public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/59354] Element swizzling produces invalid result with -O3 (tree-cunrolli pass problem?)
Date: Thu, 08 Jan 2015 11:04:00 -0000	[thread overview]
Message-ID: <bug-59354-4-gtzgGO4TIg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59354-4@http.gcc.gnu.org/bugzilla/>

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |tree-optimization
            Summary|Unexpected result in g++    |Element swizzling produces
                   |when casting int to char    |invalid result with -O3
                   |from an stl vector to an    |(tree-cunrolli pass
                   |array                       |problem?)

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
It looks to me that cunrolli pass is messing up element swizzling code.

bisection-friendly C testcase:

--cut here--
void abort (void);

unsigned int a[256];
unsigned char b[256];

int main()
{
  int i, z, x, y;

  for(i = 0; i < 256; i++)
    a[i] = i % 5;

  for (z = 0; z < 16; z++)
    for (y = 0; y < 4; y++)
      for (x = 0; x < 4; x++)
        b[y*64 + z*4 + x] = a[z*16 + y*4 + x];

  if (b[4] != 1)
    abort ();

  return 0;
}
--cut here--

gcc-5 on x86_64-linux-gnu with the above testcase:

~/gcc-build/gcc/cc1 -O3 pr59354.c
Aborted
~/gcc-build/gcc/cc1 -O3 -fdisable-tree-cunrolli pr59354.c
OK

"Working" code produces following array:

Breakpoint 1, main () at pr59354.c:18
18        if (b[4] != 1)
(gdb) p b
$1 =
"\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\003\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\002\003\004\000\003\004\000\001"...
(gdb)

while "non-working" produces:

(gdb) p b
$1 =
"\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\003\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\003\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001\004\000\001\002\000\001\002\003\001\002\003\004\002\003\004\000\003\004\000\001",
'\000' <repeats 63 times>
(gdb)
>From gcc-bugs-return-472452-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jan 08 11:08:33 2015
Return-Path: <gcc-bugs-return-472452-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 21051 invoked by alias); 8 Jan 2015 11:08:33 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 20462 invoked by uid 55); 8 Jan 2015 11:08:27 -0000
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/55212] [SH] Switch to LRA
Date: Thu, 08 Jan 2015 11:08:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: olegendo at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-55212-4-W9YNHpB0aZ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-55212-4@http.gcc.gnu.org/bugzilla/>
References: <bug-55212-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg00446.txt.bz2
Content-length: 468

https://gcc.gnu.org/bugzilla/show_bug.cgi?idU212

--- Comment #93 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Author: olegendo
Date: Thu Jan  8 11:07:45 2015
New Revision: 219341

URL: https://gcc.gnu.org/viewcvs?rev!9341&root=gcc&view=rev
Log:
gcc/
    PR target/55212
    * config/sh/sh.md (*addsi3_compact): Emit reg-reg copy instead of
    constant load if constant operand fits into I08.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/sh/sh.md


  parent reply	other threads:[~2015-01-08 11:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-30 14:25 [Bug c++/59354] New: Unexpected result in g++ when casting int to char from an stl vector to an array jori.liesenborgs at gmail dot com
2015-01-01 13:54 ` [Bug c++/59354] " gcc-bugzilla at contacts dot eelis.net
2015-01-07 20:30 ` [Bug middle-end/59354] " ville.voutilainen at gmail dot com
2015-01-08 11:04 ` ubizjak at gmail dot com [this message]
2015-01-08 14:52 ` [Bug tree-optimization/59354] [4.8/4.9/5/Regression] Element swizzling produces invalid result with -O3 (tree-cunrolli pass problem?) hjl.tools at gmail dot com
2015-01-08 14:54 ` jakub at gcc dot gnu.org
2015-01-08 14:59 ` hjl.tools at gmail dot com
2015-01-14  7:02 ` [Bug tree-optimization/59354] [4.8/4.9/5/Regression] Element swizzling produces invalid result with -O3 ubizjak at gmail dot com
2015-01-14  8:52 ` [Bug tree-optimization/59354] [4.8/4.9/5 Regression] " rguenth at gcc dot gnu.org
2015-01-14  8:57 ` jakub at gcc dot gnu.org
2015-01-14  8:59 ` ville.voutilainen at gmail dot com
2015-01-14  9:47 ` rguenther at suse dot de
2015-01-14 14:06 ` rguenth at gcc dot gnu.org
2015-01-14 14:09 ` [Bug tree-optimization/59354] [4.8/4.9 " rguenth at gcc dot gnu.org
2015-02-23 12:19 ` rguenth at gcc dot gnu.org
2015-06-23  8:46 ` [Bug tree-optimization/59354] [4.8 " rguenth 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-59354-4-gtzgGO4TIg@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).