public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/60382] New: ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352)
@ 2014-03-01 21:55 su at cs dot ucdavis.edu
  2014-03-02 22:41 ` [Bug tree-optimization/60382] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-03-01 21:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60382
           Summary: ICE on valid code at -O3 on x86_64-linux-gnu (in
                    vect_create_epilog_for_reduction, at
                    tree-vect-loop.c:4352)
           Product: gcc
           Version: unknown
            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 also seems to affect the current 4.8 branch, but not GCC 4.8.2. 

$ 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++ --disable-werror --enable-multilib
Thread model: posix
gcc version 4.9.0 20140301 (experimental) [trunk revision 208241] (GCC) 
$ 
$ gcc-trunk -O2 small.c; a.out
$ gcc-4.8.2 -O3 small.c; a.out
$ 
$ gcc-trunk -O3 small.c
small.c: In function ‘foo’:
small.c:4:1: internal compiler error: in vect_create_epilog_for_reduction, at
tree-vect-loop.c:4495
 foo ()
 ^
0xb66aa1 vect_create_epilog_for_reduction
    ../../gcc-trunk/gcc/tree-vect-loop.c:4493
0xb64c04 vectorizable_reduction(gimple_statement_base*, gimple_stmt_iterator*,
gimple_statement_base**, _slp_tree*)
    ../../gcc-trunk/gcc/tree-vect-loop.c:5344
0xb5656a vect_transform_stmt(gimple_statement_base*, gimple_stmt_iterator*,
bool*, _slp_tree*, _slp_instance*)
    ../../gcc-trunk/gcc/tree-vect-stmts.c:7226
0xb5acee vect_transform_loop(_loop_vec_info*)
    ../../gcc-trunk/gcc/tree-vect-loop.c:6054
0xb78f6b vectorize_loops()
    ../../gcc-trunk/gcc/tree-vectorizer.c:476
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.
$ 


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


int a, b, c, e, f; 

void
foo ()
{
  for (b = 0; b < 3; b++)
    if (e)
      {
    for (c = 0; c < 4; c++)
      {
        if (b)
          continue;
        f = 1;
        for (a = 0; a < 2; a++)
          f |= 1; 
      }
    for (;;) 
      ;
      }
}

int
main ()
{
  foo (); 
  return 0;
}
>From gcc-bugs-return-445188-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Mar 01 22:09:47 2014
Return-Path: <gcc-bugs-return-445188-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8267 invoked by alias); 1 Mar 2014 22:09:47 -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 8252 invoked by uid 48); 1 Mar 2014 22:09:44 -0000
From: "reichelt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60383] [4.8 Regression] ICE with invalid template specialization
Date: Sat, 01 Mar 2014 22:09:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: error-recovery, ice-on-invalid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: reichelt at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cf_known_to_work target_milestone cf_known_to_fail
Message-ID: <bug-60383-4-mKOCMenuiS@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60383-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60383-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: 2014-03/txt/msg00057.txt.bz2
Content-length: 426

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`383

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.5.0, 4.6.0, 4.7.0, 4.8.0
   Target Milestone|---                         |4.9.0
      Known to fail|                            |4.9.0


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

* [Bug tree-optimization/60382] [4.8/4.9 Regression] ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352)
  2014-03-01 21:55 [Bug tree-optimization/60382] New: ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352) su at cs dot ucdavis.edu
@ 2014-03-02 22:41 ` jakub at gcc dot gnu.org
  2014-03-03  8:58 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-02 22:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-02
                 CC|                            |jakub at gcc dot gnu.org
            Version|unknown                     |4.8.3
   Target Milestone|---                         |4.8.3
            Summary|ICE on valid code at -O3 on |[4.8/4.9 Regression] ICE on
                   |x86_64-linux-gnu (in        |valid code at -O3 on
                   |vect_create_epilog_for_redu |x86_64-linux-gnu (in
                   |ction, at                   |vect_create_epilog_for_redu
                   |tree-vect-loop.c:4352)      |ction, at
                   |                            |tree-vect-loop.c:4352)
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r206460.


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

* [Bug tree-optimization/60382] [4.8/4.9 Regression] ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352)
  2014-03-01 21:55 [Bug tree-optimization/60382] New: ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352) su at cs dot ucdavis.edu
  2014-03-02 22:41 ` [Bug tree-optimization/60382] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
@ 2014-03-03  8:58 ` rguenth at gcc dot gnu.org
  2014-03-03 13:48 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-03  8:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine.


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

* [Bug tree-optimization/60382] [4.8/4.9 Regression] ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352)
  2014-03-01 21:55 [Bug tree-optimization/60382] New: ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352) su at cs dot ucdavis.edu
  2014-03-02 22:41 ` [Bug tree-optimization/60382] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
  2014-03-03  8:58 ` rguenth at gcc dot gnu.org
@ 2014-03-03 13:48 ` rguenth at gcc dot gnu.org
  2014-03-04  8:48 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-03 13:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is that in vectorizable_reduction we compute double_reduc in a wrong
way:

  if (nested_cycle)
    {
      def_bb = gimple_bb (reduc_def_stmt);
      def_stmt_loop = def_bb->loop_father;
      def_arg = PHI_ARG_DEF_FROM_EDGE (reduc_def_stmt,
                                       loop_preheader_edge (def_stmt_loop));
      if (TREE_CODE (def_arg) == SSA_NAME
          && (def_arg_stmt = SSA_NAME_DEF_STMT (def_arg))
          && gimple_code (def_arg_stmt) == GIMPLE_PHI
          && flow_bb_inside_loop_p (outer_loop, gimple_bb (def_arg_stmt))
          && vinfo_for_stmt (def_arg_stmt)
          && STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def_arg_stmt))
              == vect_double_reduction_def)
        double_reduc = true;
    }

that is because def_arg is a constant (and the outer loop reduction PHI
is dead).  Easiest is to not detect this as a valid reduction with
sth like

Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c        (revision 208269)
+++ gcc/tree-vect-loop.c        (working copy)
@@ -2193,6 +2193,12 @@ vect_is_simple_reduction_1 (loop_vec_inf
               || (!check_reduction && flow_loop_nested_p (vect_loop, loop)));

   name = PHI_RESULT (phi);
+  /* ???  If there are no uses of the PHI result the inner loop reduction
+     won't be detected as possibly double-reduction by vectorizable_reduction
+     because that tries to walk the PHI arg from the preheader edge which
+     can be constant.  See PR60382.  */
+  if (has_zero_uses (name))
+    return NULL;
   nloop_uses = 0;
   FOR_EACH_IMM_USE_FAST (use_p, imm_iter, name)
     {


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

* [Bug tree-optimization/60382] [4.8/4.9 Regression] ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352)
  2014-03-01 21:55 [Bug tree-optimization/60382] New: ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352) su at cs dot ucdavis.edu
                   ` (2 preceding siblings ...)
  2014-03-03 13:48 ` rguenth at gcc dot gnu.org
@ 2014-03-04  8:48 ` rguenth at gcc dot gnu.org
  2014-03-04 11:03 ` [Bug tree-optimization/60382] [4.8 " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-04  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Mar  4 08:47:55 2014
New Revision: 208305

URL: http://gcc.gnu.org/viewcvs?rev=208305&root=gcc&view=rev
Log:
2014-03-04  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/60382
    * tree-vect-loop.c (vect_is_simple_reduction_1): Do not consider
    dead PHIs a reduction.

    * gcc.dg/vect/pr60382.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr60382.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-loop.c


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

* [Bug tree-optimization/60382] [4.8 Regression] ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352)
  2014-03-01 21:55 [Bug tree-optimization/60382] New: ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352) su at cs dot ucdavis.edu
                   ` (4 preceding siblings ...)
  2014-03-04 11:03 ` [Bug tree-optimization/60382] [4.8 " rguenth at gcc dot gnu.org
@ 2014-03-04 11:03 ` rguenth at gcc dot gnu.org
  2014-05-11 14:38 ` mikpelinux at gmail dot com
  2014-05-13  8:18 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-04 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Mar  4 11:02:47 2014
New Revision: 208310

URL: http://gcc.gnu.org/viewcvs?rev=208310&root=gcc&view=rev
Log:
2014-03-04  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/60382
    * tree-vect-loop.c (vect_is_simple_reduction_1): Do not consider
    dead PHIs a reduction.

    * gcc.dg/vect/pr60382.c: New testcase.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/vect/pr60382.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/gcc/tree-vect-loop.c


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

* [Bug tree-optimization/60382] [4.8 Regression] ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352)
  2014-03-01 21:55 [Bug tree-optimization/60382] New: ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352) su at cs dot ucdavis.edu
                   ` (3 preceding siblings ...)
  2014-03-04  8:48 ` rguenth at gcc dot gnu.org
@ 2014-03-04 11:03 ` rguenth at gcc dot gnu.org
  2014-03-04 11:03 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-04 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.


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

* [Bug tree-optimization/60382] [4.8 Regression] ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352)
  2014-03-01 21:55 [Bug tree-optimization/60382] New: ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352) su at cs dot ucdavis.edu
                   ` (5 preceding siblings ...)
  2014-03-04 11:03 ` rguenth at gcc dot gnu.org
@ 2014-05-11 14:38 ` mikpelinux at gmail dot com
  2014-05-13  8:18 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: mikpelinux at gmail dot com @ 2014-05-11 14:38 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Pettersson <mikpelinux at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpelinux at gmail dot com

--- Comment #7 from Mikael Pettersson <mikpelinux at gmail dot com> ---
The recent backport of the PR59715 fix to the 4.7 branch caused the PR60382
regression to also appear there:

> /tmp/objdir/gcc/xgcc -B/tmp/objdir/gcc -O3 -c pr60382.c
pr60382.c: In function 'foo':
pr60382.c:4:1: internal compiler error: in vect_create_epilog_for_reduction, at
tree-vect-loop.c:4180

[4.7-20140510 on x86_64-linux]

Backporting the PR60382 fix from 4.8 to 4.7 fixes the ICE.


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

* [Bug tree-optimization/60382] [4.8 Regression] ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352)
  2014-03-01 21:55 [Bug tree-optimization/60382] New: ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352) su at cs dot ucdavis.edu
                   ` (6 preceding siblings ...)
  2014-05-11 14:38 ` mikpelinux at gmail dot com
@ 2014-05-13  8:18 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-13  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
hmm, interesting - I can't reproduce the failure but will backport anyway (it's
a safe fix).


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

end of thread, other threads:[~2014-05-13  8:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-01 21:55 [Bug tree-optimization/60382] New: ICE on valid code at -O3 on x86_64-linux-gnu (in vect_create_epilog_for_reduction, at tree-vect-loop.c:4352) su at cs dot ucdavis.edu
2014-03-02 22:41 ` [Bug tree-optimization/60382] [4.8/4.9 Regression] " jakub at gcc dot gnu.org
2014-03-03  8:58 ` rguenth at gcc dot gnu.org
2014-03-03 13:48 ` rguenth at gcc dot gnu.org
2014-03-04  8:48 ` rguenth at gcc dot gnu.org
2014-03-04 11:03 ` [Bug tree-optimization/60382] [4.8 " rguenth at gcc dot gnu.org
2014-03-04 11:03 ` rguenth at gcc dot gnu.org
2014-05-11 14:38 ` mikpelinux at gmail dot com
2014-05-13  8:18 ` 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).