public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/59519] New: ICE on valid code at -O3 on x86_64-linux-gnu in slpeel_update_phi_nodes_for_guard1, at tree-vect-loop-manip.c:486
@ 2013-12-16  1:39 su at cs dot ucdavis.edu
  2013-12-16 17:19 ` [Bug tree-optimization/59519] " su at cs dot ucdavis.edu
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: su at cs dot ucdavis.edu @ 2013-12-16  1:39 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 9716 bytes --]

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

            Bug ID: 59519
           Summary: ICE on valid code at -O3 on x86_64-linux-gnu in
                    slpeel_update_phi_nodes_for_guard1, at
                    tree-vect-loop-manip.c:486
           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 following code causes an ICE when compiled with the current gcc trunk at
-O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes. 

It is a regression from 4.8.x. 

$ 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 --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++,lto --enable-checking=release --disable-werror
--enable-multilib
Thread model: posix
gcc version 4.9.0 20131215 (experimental) [trunk revision 206004] (GCC) 
$ 
$ gcc-trunk -O2 -c small.c
$ gcc-4.8 -O3 -c small.c
$ 
$ gcc-trunk -O3 -c small.c
small.c: In function ‘foo’:
small.c:9:1: internal compiler error: in slpeel_update_phi_nodes_for_guard1, at
tree-vect-loop-manip.c:486
 foo ()
 ^
0xa01706 slpeel_update_phi_nodes_for_guard1
    ../../gcc-trunk/gcc/tree-vect-loop-manip.c:486
0xa01706 slpeel_tree_peel_loop_to_edge
    ../../gcc-trunk/gcc/tree-vect-loop-manip.c:1411
0xa02281 vect_do_peeling_for_alignment(_loop_vec_info*, tree_node*, unsigned
int, bool)
    ../../gcc-trunk/gcc/tree-vect-loop-manip.c:2009
0x9f624f vect_transform_loop(_loop_vec_info*)
    ../../gcc-trunk/gcc/tree-vect-loop.c:5797
0xa0dacf vectorize_loops()
    ../../gcc-trunk/gcc/tree-vectorizer.c:473
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 


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


struct
{
  int f0;
} d;

int a[8] = {0}, b, c, e;

void
foo ()
{
  for (; e < 1; e++)
    for (b = 0; b < 7; b++)
      {
    c |= (a[b+1] != 0);
    if (d.f0)
      break;
      }
}
>From gcc-bugs-return-437678-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Dec 16 02:23:05 2013
Return-Path: <gcc-bugs-return-437678-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30404 invoked by alias); 16 Dec 2013 02:23:04 -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 30379 invoked by uid 48); 16 Dec 2013 02:23:00 -0000
From: "su at cs dot ucdavis.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/59520] New: a possible inconsistency in error diagnostics with "-pedantic -stdÉ9"
Date: Mon, 16 Dec 2013 02:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.9.0
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-59520-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-12/txt/msg01333.txt.bz2
Content-length: 2119

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

            Bug ID: 59520
           Summary: a possible inconsistency in error diagnostics with
                    "-pedantic -std=c99"
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

I wonder whether or not the following examples illustrate an unintended
inconsistency with error diagnostics in GCC. 

In particular, should the diagnostic message be a warning for error3.c rather
than an error as shown below?  

error3.c:1:5: error: zero or negative size array ‘a’
 int a[] = {}; 
     ^

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

$ gcc-trunk -pedantic -std=c99 -c error1.c
error1.c:1:12: warning: ISO C forbids empty initializer braces [-Wpedantic]
 int a[1] = {};
            ^
$ clang-trunk -pedantic -std=c99 -c error1.c
error1.c:1:12: warning: use of GNU empty initializer extension
[-Wgnu-empty-initializer]
int a[1] = {};
           ^
1 warning generated.
$ cat error1.c
int a[1] = {};
$ 

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

$ gcc-trunk -pedantic -std=c99 -c error2.c
error2.c:1:5: warning: array ‘a’ assumed to have one element [enabled by
default]
 int a[];
     ^
$ clang-trunk -pedantic -std=c99 -c error2.c
error2.c:1:5: warning: tentative array definition assumed to have one element
int a[];
    ^
1 warning generated.
$ cat error2.c
int a[];
$ 

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

$ gcc-trunk -pedantic -std=c99 -c error3.c
error3.c:1:11: warning: ISO C forbids empty initializer braces [-Wpedantic]
 int a[] = {}; 
           ^
error3.c:1:5: error: zero or negative size array ‘a’
 int a[] = {}; 
     ^
$ clang-trunk -pedantic -std=c99 -c error3.c
error3.c:1:11: warning: use of GNU empty initializer extension
[-Wgnu-empty-initializer]
int a[] = {}; 
          ^
error3.c:1:11: warning: zero size arrays are an extension [-Wzero-length-array]
2 warnings generated.
$ cat error3.c
int a[] = {}; 
$
>From gcc-bugs-return-437679-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Dec 16 02:27:33 2013
Return-Path: <gcc-bugs-return-437679-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 32292 invoked by alias); 16 Dec 2013 02:27: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 32273 invoked by uid 48); 16 Dec 2013 02:27:29 -0000
From: "drepper.fsp at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/59521] New: __builtin_expect not effective in switch
Date: Mon, 16 Dec 2013 02:27:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: drepper.fsp at gmail dot com
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-59521-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-12/txt/msg01334.txt.bz2
Content-length: 1857

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

            Bug ID: 59521
           Summary: __builtin_expect not effective in switch
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drepper.fsp at gmail dot com

When used in switch, __builtin_expect should reorder the comparisons
appropriately.  Take this code:

#include <stdio.h>
void
f(int ch) {
  switch (__builtin_expect(ch, 333)) {
    case 3: puts("a"); break;
    case 42: puts("e"); break;
    case 333: puts("i"); break;
    }
}

Current mainline (and also prior versions, I tested 4.8.2) produce with -O3
code like this:

0000000000000000 <f>:
   0:    83 ff 2a                 cmp    $0x2a,%edi
   3:    74 33                    je     38 <f+0x38>
   5:    81 ff 4d 01 00 00        cmp    $0x14d,%edi
   b:    74 1b                    je     28 <f+0x28>
   d:    83 ff 03                 cmp    $0x3,%edi
  10:    74 06                    je     18 <f+0x18>
  12:    c3                       retq
  13:    0f 1f 44 00 00           nopl   0x0(%rax,%rax,1)
  18:    bf 00 00 00 00           mov    $0x0,%edi
  1d:    e9 00 00 00 00           jmpq   22 <f+0x22>
  22:    66 0f 1f 44 00 00        nopw   0x0(%rax,%rax,1)
  28:    bf 00 00 00 00           mov    $0x0,%edi
  2d:    e9 00 00 00 00           jmpq   32 <f+0x32>
  32:    66 0f 1f 44 00 00        nopw   0x0(%rax,%rax,1)
  38:    bf 00 00 00 00           mov    $0x0,%edi
  3d:    e9 00 00 00 00           jmpq   42 <f+0x42>

Instead the test for 333/$0x14d should have been moved to the front.


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

end of thread, other threads:[~2014-01-04 12:03 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-16  1:39 [Bug tree-optimization/59519] New: ICE on valid code at -O3 on x86_64-linux-gnu in slpeel_update_phi_nodes_for_guard1, at tree-vect-loop-manip.c:486 su at cs dot ucdavis.edu
2013-12-16 17:19 ` [Bug tree-optimization/59519] " su at cs dot ucdavis.edu
2013-12-17 19:21 ` [Bug tree-optimization/59519] [4.9 Regression] " mpolacek at gcc dot gnu.org
2013-12-19 11:46 ` jakub at gcc dot gnu.org
2013-12-19 12:02 ` amker.cheng at gmail dot com
2013-12-19 14:45 ` amker.cheng at gmail dot com
2013-12-20 10:28 ` amker.cheng at gmail dot com
2014-01-02 15:52 ` jakub at gcc dot gnu.org
2014-01-03  2:18 ` amker.cheng at gmail dot com
2014-01-03 10:01 ` jakub at gcc dot gnu.org
2014-01-03 10:08 ` amker.cheng at gmail dot com
2014-01-03 10:24 ` jakub at gcc dot gnu.org
2014-01-03 13:22 ` jakub at gcc dot gnu.org
2014-01-04 11:23 ` jakub at gcc dot gnu.org
2014-01-04 12:03 ` jakub 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).