public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/50133] New: [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im
@ 2011-08-19 21:58 zsojka at seznam dot cz
  2011-08-19 23:05 ` [Bug tree-optimization/50133] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2011-08-19 21:58 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50133
           Summary: [4.7 Regression] ICE: SIGSEGV in
                    vect_finish_stmt_generation (gimple.h:4821) with
                    -ftree-vectorize -fno-tree-loop-im
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zsojka@seznam.cz
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu


Created attachment 25057
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25057
testcase (gcc.dg/pr46184.c)

Compiler output:
$ gcc -O -ftree-vectorize -fno-tree-loop-im testcase.c
==6443== Invalid read of size 8
==6443==    at 0xB053E1: vect_finish_stmt_generation(gimple_statement_d*,
gimple_statement_d*, gimple_stmt_iterator*) (gimple.h:4821)
==6443==    by 0xB05C8E: vect_init_vector(gimple_statement_d*, tree_node*,
tree_node*, gimple_stmt_iterator*) (tree-vect-stmts.c:1082)
==6443==    by 0xB07625: vectorizable_load(gimple_statement_d*,
gimple_stmt_iterator*, gimple_statement_d**, _slp_tree*, _slp_instance*)
(tree-vect-stmts.c:4626)
==6443==    by 0xB1268C: vect_transform_stmt(gimple_statement_d*,
gimple_stmt_iterator*, bool*, _slp_tree*, _slp_instance*)
(tree-vect-stmts.c:5197)
==6443==    by 0xB2270B: vect_transform_loop(_loop_vec_info*)
(tree-vect-loop.c:5332)
==6443==    by 0xB2F678: vectorize_loops() (tree-vectorizer.c:205)
==6443==    by 0x8A6046: execute_one_pass(opt_pass*) (passes.c:2063)
==6443==    by 0x8A63B4: execute_pass_list(opt_pass*) (passes.c:2118)
==6443==    by 0x8A63C6: execute_pass_list(opt_pass*) (passes.c:2119)
==6443==    by 0x8A63C6: execute_pass_list(opt_pass*) (passes.c:2119)
==6443==    by 0x9FE69D: tree_rest_of_compilation(tree_node*)
(tree-optimize.c:420)
==6443==    by 0x653A55: cgraph_expand_function(cgraph_node*)
(cgraphunit.c:1797)
==6443==    by 0x6557BA: cgraph_optimize() (cgraphunit.c:1856)
==6443==    by 0x655E49: cgraph_finalize_compilation_unit() (cgraphunit.c:1310)
==6443==    by 0x537367: c_write_global_declarations() (c-decl.c:9881)
==6443==    by 0x99C191: toplev_main(int, char**) (toplev.c:564)
==6443==    by 0x6734D2C: (below main) (in /lib64/libc-2.12.2.so)
==6443==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==6443== 
testcase.c: In function 'foo':
testcase.c:4:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r177889 - crash
r177543 - crash
r173150 - OK


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

* [Bug tree-optimization/50133] [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im
  2011-08-19 21:58 [Bug tree-optimization/50133] New: [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im zsojka at seznam dot cz
@ 2011-08-19 23:05 ` rguenth at gcc dot gnu.org
  2011-08-21  7:56 ` irar at il dot ibm.com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-08-19 23:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.0


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

* [Bug tree-optimization/50133] [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im
  2011-08-19 21:58 [Bug tree-optimization/50133] New: [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im zsojka at seznam dot cz
  2011-08-19 23:05 ` [Bug tree-optimization/50133] " rguenth at gcc dot gnu.org
@ 2011-08-21  7:56 ` irar at il dot ibm.com
  2011-08-21  9:17 ` irar at il dot ibm.com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: irar at il dot ibm.com @ 2011-08-21  7:56 UTC (permalink / raw)
  To: gcc-bugs

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

Ira Rosen <irar at il dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |irar at il dot ibm.com

--- Comment #1 from Ira Rosen <irar at il dot ibm.com> 2011-08-21 06:02:10 UTC ---
When creating a vector from an invariant scalar load, we do 
gsi_next (&gsi2); 
in order to insert the vector after the load. In this testcase the load is the
last stmt in its basic block, which causes the failure when we try to call
gsi_stmt().

This patch fixes the failure:
Index: tree-vect-stmts.c
===================================================================
--- tree-vect-stmts.c   (revision 177929)
+++ tree-vect-stmts.c   (working copy)
@@ -1435,6 +1435,9 @@ vect_finish_stmt_generation (gimple stmt, gimple v
     }

   si = *gsi;
+  if (gsi_end_p (si))
+    si = gsi_for_stmt (stmt);
+
   if (is_gimple_debug (gsi_stmt (si)))
     {
       gsi_next_nondebug (&si);

but it's a hack.

We could add a new parameter insert_after to vect_finish_stmt_generation (), to
indicate that VECT_STMT should be inserted after GSI and not before. For this
case we would have to pass it to vect_init_vector() first.

Ira


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

* [Bug tree-optimization/50133] [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im
  2011-08-19 21:58 [Bug tree-optimization/50133] New: [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im zsojka at seznam dot cz
  2011-08-19 23:05 ` [Bug tree-optimization/50133] " rguenth at gcc dot gnu.org
  2011-08-21  7:56 ` irar at il dot ibm.com
@ 2011-08-21  9:17 ` irar at il dot ibm.com
  2011-08-21 18:09 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: irar at il dot ibm.com @ 2011-08-21  9:17 UTC (permalink / raw)
  To: gcc-bugs

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

Ira Rosen <irar at il dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-08-21
     Ever Confirmed|0                           |1


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

* [Bug tree-optimization/50133] [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im
  2011-08-19 21:58 [Bug tree-optimization/50133] New: [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2011-08-21  9:17 ` irar at il dot ibm.com
@ 2011-08-21 18:09 ` jakub at gcc dot gnu.org
  2011-08-22  9:40 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-08-21 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-21 17:43:08 UTC ---
Insert before gsi_end_p should be fine, you just can't copy locus from it in
that case.  So you could as well do something like:
  si = *gsi;
  if (gsi_end_p (si))
    {
      gsi_prev (&si);
      gsi_prev_nondebug (&si);
    }
  else if (is_gimple_debug (gsi_stmt (si)))
    {
      gsi_next_nondebug (&si);
      gcc_assert (!gsi_end_p (si));
    }

where the first gsi_prev would move from the end to the newly inserted stmt and
gsi_prev_nondebug to the previous stmt (skipping any debug stmts).
This wouldn't work when inserting into a completely empty bb, but does the
vectorizer ever do something like that?


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

* [Bug tree-optimization/50133] [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im
  2011-08-19 21:58 [Bug tree-optimization/50133] New: [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2011-08-21 18:09 ` jakub at gcc dot gnu.org
@ 2011-08-22  9:40 ` jakub at gcc dot gnu.org
  2011-08-22 10:28 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-08-22  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-22 09:31:23 UTC ---
Created attachment 25074
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25074
gcc47-pr50133.patch

Untested fix.


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

* [Bug tree-optimization/50133] [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im
  2011-08-19 21:58 [Bug tree-optimization/50133] New: [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2011-08-22  9:40 ` jakub at gcc dot gnu.org
@ 2011-08-22 10:28 ` jakub at gcc dot gnu.org
  2011-08-22 15:12 ` jakub at gcc dot gnu.org
  2011-08-23  9:58 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-08-22 10:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-22 09:59:51 UTC ---
Or, alternatively can't we use:
  gimple_set_location (vec_stmt, gimple_location (stmt));
instead (and remove all the si handling stuff)?
It seems before PR37482 we were using the scalar stmt's location instead of the
gsi, which makes much more sense to me.  Ira, any reason why you've changed it?
I mean the asserts obviously with the patch had to be removed, but I wonder
about the gimple_set_location line...


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

* [Bug tree-optimization/50133] [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im
  2011-08-19 21:58 [Bug tree-optimization/50133] New: [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2011-08-22 10:28 ` jakub at gcc dot gnu.org
@ 2011-08-22 15:12 ` jakub at gcc dot gnu.org
  2011-08-23  9:58 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-08-22 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-22 15:01:47 UTC ---
Author: jakub
Date: Mon Aug 22 15:01:42 2011
New Revision: 177958

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177958
Log:
    PR tree-optimization/50133
    * tree-vect-stmts.c (vect_finish_stmt_generation): Copy location
    from stmt instead of some statement around gsi.

    * gcc.dg/pr50133.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr50133.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-stmts.c


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

* [Bug tree-optimization/50133] [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im
  2011-08-19 21:58 [Bug tree-optimization/50133] New: [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2011-08-22 15:12 ` jakub at gcc dot gnu.org
@ 2011-08-23  9:58 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-08-23  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-23 09:41:14 UTC ---
Fixed.


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

end of thread, other threads:[~2011-08-23  9:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-19 21:58 [Bug tree-optimization/50133] New: [4.7 Regression] ICE: SIGSEGV in vect_finish_stmt_generation (gimple.h:4821) with -ftree-vectorize -fno-tree-loop-im zsojka at seznam dot cz
2011-08-19 23:05 ` [Bug tree-optimization/50133] " rguenth at gcc dot gnu.org
2011-08-21  7:56 ` irar at il dot ibm.com
2011-08-21  9:17 ` irar at il dot ibm.com
2011-08-21 18:09 ` jakub at gcc dot gnu.org
2011-08-22  9:40 ` jakub at gcc dot gnu.org
2011-08-22 10:28 ` jakub at gcc dot gnu.org
2011-08-22 15:12 ` jakub at gcc dot gnu.org
2011-08-23  9:58 ` 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).