public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/58731] New: wrong code (hangs) at -O3 on x86_64-linux-gnu
@ 2013-10-15  1:24 su at cs dot ucdavis.edu
  2013-10-15  8:17 ` [Bug tree-optimization/58731] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: su at cs dot ucdavis.edu @ 2013-10-15  1:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58731
           Summary: wrong code (hangs) at -O3 on x86_64-linux-gnu
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The current gcc trunk and gcc 4.8 produce wrong code that hangs for the
following testcase on x86_64-linux when compiled at -O3 (in both 32-bit and
64-bit modes). 

This is a regression from 4.7.x.

The testcase also triggers a different issue at -O2: a spurious "undefined
behavior" warning (see below). 

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure
--enable-languages=c,c++,objc,obj-c++,fortran,lto --disable-werror
--enable-checking=release --with-gmp=/usr/local/gcc-trunk
--with-mpfr=/usr/local/gcc-trunk --with-mpc=/usr/local/gcc-trunk
--with-cloog=/usr/local/gcc-trunk --prefix=/usr/local/gcc-trunk
Thread model: posix
gcc version 4.9.0 20131014 (experimental) [trunk revision 203572] (GCC) 
$ 
$ gcc-trunk -O2 small.c; a.out
small.c: In function ‘main’:
cc1: warning: iteration 5u invokes undefined behavior
[-Waggressive-loop-optimizations]
small.c:6:3: note: containing loop
   for (b = 4; b > -30; b--)
   ^
$ 
$ gcc-trunk -Os small.c; a.out
$
$ gcc-trunk -O3 small.c; a.out
^C
$ gcc-4.8 -O3 small.c; a.out
^C
$
$ gcc-4.7 -O3 small.c; a.out
$  


----------------------------------


int a, b, c, d, e;

int
main ()
{
  for (b = 4; b > -30; b--)
    for (; c;)
      for (;;)
    {
      e = a > 2147483647 - b;
      if (d)
        break;
    }
  return 0;
}
>From gcc-bugs-return-431706-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Oct 15 03:43:26 2013
Return-Path: <gcc-bugs-return-431706-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3902 invoked by alias); 15 Oct 2013 03:43:26 -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 3856 invoked by uid 48); 15 Oct 2013 03:43:22 -0000
From: "su at cs dot ucdavis.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/58732] New: wrong code at -O3 on x86_64-linux-gnu
Date: Tue, 15 Oct 2013 03:43:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: su at cs dot ucdavis.edu
X-Bugzilla-Status: UNCONFIRMED
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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-58732-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: 2013-10/txt/msg00850.txt.bz2
Content-length: 1504

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX732

            Bug ID: 58732
           Summary: wrong code at -O3 on x86_64-linux-gnu
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The attached testcase is miscompiled by gcc 4.8.1 on x86_64-linux-gnu at -O3 in
both 32-bit and 64-bit modes.

It does not seem to affect the current gcc trunk, 4.6.x, and 4.7.x.

$ gcc-4.8 -v
Using built-in specs.
COLLECT_GCC=gcc-4.8
COLLECT_LTO_WRAPPER=/usr/local/gcc-4.8/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8.1/configure
--enable-languages=c,c++,objc,obj-c++,fortran,lto --disable-checking
--with-gmp=/usr/local/gcc-4.8 --with-mpfr=/usr/local/gcc-4.8
--with-mpc=/usr/local/gcc-4.8 --with-cloog=/usr/local/gcc-4.8
--prefix=/usr/local/gcc-4.8
Thread model: posix
gcc version 4.8.1 (GCC)
$
$ gcc-4.8 -O2 small.c; a.out
$
$ gcc-4.8 -O3 small.c; a.out
Aborted (core dumped)
$
$ gcc-trunk -O3 small.c; a.out
$ gcc-4.6 -O3 small.c; a.out
$ gcc-4.7 -O3 small.c; a.out
$


--------------------------------


static int a = -1, c, d;
int b[10];

int
main ()
{
  for (d = 1; d >= 0; d--)
    {
      b[8] = 0;
      for (c = 0; c; c++)
    ;
      b[d+8] = a;
    }

  if (b[8] != -1)
    __builtin_abort();

  return 0;
}


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

* [Bug tree-optimization/58731] wrong code (hangs) at -O3 on x86_64-linux-gnu
  2013-10-15  1:24 [Bug tree-optimization/58731] New: wrong code (hangs) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
@ 2013-10-15  8:17 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-10-15  8:17 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Disabling LIM fixes this, disabling PRE not (and PRE alone is not enough to
trigger it - even though it clearly may).

*** This bug has been marked as a duplicate of bug 58143 ***


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

end of thread, other threads:[~2013-10-15  8:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-15  1:24 [Bug tree-optimization/58731] New: wrong code (hangs) at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
2013-10-15  8:17 ` [Bug tree-optimization/58731] " rguenth at gcc dot gnu.org

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).