public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/52678] New: internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842
@ 2012-03-22 21:45 utke at mcs dot anl.gov
  2012-03-23  7:38 ` [Bug tree-optimization/52678] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: utke at mcs dot anl.gov @ 2012-03-22 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52678
           Summary: internal compiler error: in
                    vect_update_ivs_after_vectorizer, at
                    tree-vect-loop-manip.c:1842
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: utke@mcs.anl.gov


Created attachment 26961
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26961
Fortran sources + Makefile to  recreate the ICE

I have seen this this problem in the 4.6.x realeases and now also see it in 4.7
and decided it is time to report it given in particular that a similar bug 
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45971
has been closed as fixed. 

I have: 
> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/sandbox/Apps/gcc-4.7.0_inst/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.7.0/configure --prefix=/sandbox/Apps/gcc-4.7.0_inst
--with-mpfr=/sandbox/Apps/mpfr-3.0.1_inst
--with-gmp=/sandbox/Apps/gmp-5.0.1_inst --with-mpc=/sandbox/Apps/mpc-0.8.2_inst
--enable-languages=c,c++,fortran --with-ppl=/sandbox/Apps/ppl-0.11_inst
--with-cloog=/sandbox/Apps/cloog-0.16.2_inst --enable-cloog-backend=isl
--disable-multilib
Thread model: posix
gcc version 4.7.0 (GCC) 

and see the error with: 
gfortran -fconvert=big-endian -fimplicit-none -fPIC -O3 -funroll-loops -c
-ffixed-form ad_input_code_sf.w2f.pre.xb.x2w.w2f.td0043.f90
ad_input_code_sf.w2f.pre.xb.x2w.w2f.td0043.f90: In function
‘openad_set_ref_state’:
ad_input_code_sf.w2f.pre.xb.x2w.w2f.td0043.f90:3:0: internal compiler error: in
vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842
Please submit a full bug report,
with preprocessed source if appropriate.


The file is the product of some source transformation, has > 1700 source lines
and is one of over 300 files in the project  to be compiled. 
The reason why I didn't submit it earlier is that given the above it is hard to
whittle down the problem to small example.  The tar file in the attachment is
the minimal set of sources without further trying to reduce the file size. Note
that it consists of fixed and free form f90. Because of the module order I
included a Makefile that has the order correct and yields the ICE when invoked. 

Compiling with -O0 removes the ICE.  

Adding -Wall -Wextra  gives some warnings about string truncations and possible
value changes in integer assignments none of which I are an actual problem
right now even though they should probably be addressed eventually. 

Adding  -fno-strict-aliasing -fwrapv (as suggested on the bugs page) does not
make a difference.


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

* [Bug tree-optimization/52678] internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842
  2012-03-22 21:45 [Bug tree-optimization/52678] New: internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842 utke at mcs dot anl.gov
@ 2012-03-23  7:38 ` rguenth at gcc dot gnu.org
  2012-03-23  9:30 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-23  7:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-03-23
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-23 07:06:43 UTC ---
I will have a look.


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

* [Bug tree-optimization/52678] internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842
  2012-03-22 21:45 [Bug tree-optimization/52678] New: internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842 utke at mcs dot anl.gov
  2012-03-23  7:38 ` [Bug tree-optimization/52678] " rguenth at gcc dot gnu.org
@ 2012-03-23  9:30 ` rguenth at gcc dot gnu.org
  2012-03-23  9:33 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-23  9:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-23 09:06:32 UTC ---
I can reproduce the ICE, it's one of the more fragile areas of the
vectorizer...

Reduced testcase, ICEs at -O -ftree-vectorize -ffixed-form:

      SUBROUTINE OpenAD_set_ref_state(DRF, RHOFACF, RHOFACC) 
      real(8) DRF(1 : 15)
      real(8) RHOFACF(1 : 16)
      real(8) RHOFACC(1 : 15)
      integer, dimension(:), allocatable :: oad_it
      integer :: oad_it_ptr
      INTEGER(8) OpenAD_Symbol_188
      INTEGER(4) K
          OpenAD_Symbol_188 = 0
          DO K = 2, 15, 1
            RHOFACF(INT(K)) = ((RHOFACC(K) * DRF(K + (-1)) + RHOFACC(K +
     + (-1)) * DRF(K)) /(DRF(K) + DRF(K + (-1))))
            OpenAD_Symbol_188 = (INT(OpenAD_Symbol_188) + INT(1))
          END DO
          oad_it(oad_it_ptr) = OpenAD_Symbol_188
      end subroutine OpenAD_set_ref_state


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

* [Bug tree-optimization/52678] internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842
  2012-03-22 21:45 [Bug tree-optimization/52678] New: internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842 utke at mcs dot anl.gov
  2012-03-23  7:38 ` [Bug tree-optimization/52678] " rguenth at gcc dot gnu.org
  2012-03-23  9:30 ` rguenth at gcc dot gnu.org
@ 2012-03-23  9:33 ` rguenth at gcc dot gnu.org
  2012-03-23 10:30 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-23  9:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-23 09:29:07 UTC ---
The issue is that for an induction variable i in

 long i;
 for (i = 0; i < 15; i = (int) i + 1)
   ;

we know its evolution if we know the number of iterations which we know
because we know its initial value.  For the epilogue loop though we then
see (after deciding to vectorize)

 for (; i < n; i = (int) i + 1)
   ;

where we neither see the lower nor upper bound and due to the truncation
we cannot analyze its evolution anymore.

The issue is, of course, that we only need the evolution part and that
this evolution part does not change from the initial scalar loop, so
we could just use that which we could analyze easily.  But we choose
to re-analyze the epilogue loop :(


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

* [Bug tree-optimization/52678] internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842
  2012-03-22 21:45 [Bug tree-optimization/52678] New: internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842 utke at mcs dot anl.gov
                   ` (2 preceding siblings ...)
  2012-03-23  9:33 ` rguenth at gcc dot gnu.org
@ 2012-03-23 10:30 ` rguenth at gcc dot gnu.org
  2012-03-23 11:40 ` [Bug tree-optimization/52678] [4.7 Regression] " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-23 10:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-23 10:19:53 UTC ---
Created attachment 26966
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26966
patch

No, in fact, generating the _prologue_ loop adjusts the original PHI node from

  openad_symbol_188_2 = PHI <0(2), openad_symbol_188_42(4)>

to

  openad_symbol_188_2 = PHI <openad_symbol_188_105(17),
openad_symbol_188_42(4)>

and we _do_ analyze that original loop PHI.  But now fail to.

One solution would be to delay peeling for the prologue loop after we peeled
the epilogue loop - but that has quite some fallout.  Another solution would
be to save the scalar evolution result, but we explicitely free it after
the first peeling (because obviously while the evolution part of
openad_symbol_188_2 is still correct, it's initial value is not).

So the correct thing seems to be to preserve the evolution part and simply
take the initial value from the PHI operand.


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

* [Bug tree-optimization/52678] [4.7 Regression] internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842
  2012-03-22 21:45 [Bug tree-optimization/52678] New: internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842 utke at mcs dot anl.gov
                   ` (3 preceding siblings ...)
  2012-03-23 10:30 ` rguenth at gcc dot gnu.org
@ 2012-03-23 11:40 ` rguenth at gcc dot gnu.org
  2012-03-23 12:33 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-23 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.6.3
   Target Milestone|---                         |4.7.1
            Summary|internal compiler error: in |[4.7 Regression] internal
                   |vect_update_ivs_after_vecto |compiler error: in
                   |rizer, at                   |vect_update_ivs_after_vecto
                   |tree-vect-loop-manip.c:1842 |rizer, at
                   |                            |tree-vect-loop-manip.c:1842

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-23 11:34:10 UTC ---
Fixed on trunk sofar.

Works on the 4.6 branch for me (well, the reduced testcase at least).  Queued
for backporting at some point.


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

* [Bug tree-optimization/52678] [4.7 Regression] internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842
  2012-03-22 21:45 [Bug tree-optimization/52678] New: internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842 utke at mcs dot anl.gov
                   ` (4 preceding siblings ...)
  2012-03-23 11:40 ` [Bug tree-optimization/52678] [4.7 Regression] " rguenth at gcc dot gnu.org
@ 2012-03-23 12:33 ` rguenth at gcc dot gnu.org
  2012-04-03 10:14 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-23 12:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-23 11:34:37 UTC ---
Author: rguenth
Date: Fri Mar 23 11:34:32 2012
New Revision: 185734

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185734
Log:
2012-03-23  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/52678
    * tree-vectorizer.h (struct _stmt_vec_info): Add
    loop_phi_evolution_part member.
    (STMT_VINFO_LOOP_PHI_EVOLUTION_PART): New define.
    * tree-vect-loop.c (vect_analyze_scalar_cycles_1): Initialize
    STMT_VINFO_LOOP_PHI_EVOLUTION_PART.
    * tree-vect-loop-manip.c (vect_update_ivs_after_vectorizer):
    Use the cached evolution part and the PHI nodes value from
    the loop preheader edge instead of re-analyzing the evolution.

    * gfortran.dg/pr52678.f: New testcase.

Added:
    trunk/gcc/testsuite/gfortran.dg/pr52678.f
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-loop-manip.c
    trunk/gcc/tree-vect-loop.c
    trunk/gcc/tree-vectorizer.h


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

* [Bug tree-optimization/52678] [4.7 Regression] internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842
  2012-03-22 21:45 [Bug tree-optimization/52678] New: internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842 utke at mcs dot anl.gov
                   ` (5 preceding siblings ...)
  2012-03-23 12:33 ` rguenth at gcc dot gnu.org
@ 2012-04-03 10:14 ` rguenth at gcc dot gnu.org
  2012-04-03 11:57 ` rguenth at gcc dot gnu.org
  2012-04-03 12:00 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-03 10:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |52701

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-03 10:13:57 UTC ---
The fix for PR52701 also needs backporting.


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

* [Bug tree-optimization/52678] [4.7 Regression] internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842
  2012-03-22 21:45 [Bug tree-optimization/52678] New: internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842 utke at mcs dot anl.gov
                   ` (6 preceding siblings ...)
  2012-04-03 10:14 ` rguenth at gcc dot gnu.org
@ 2012-04-03 11:57 ` rguenth at gcc dot gnu.org
  2012-04-03 12:00 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-03 11:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-03 11:55:29 UTC ---
Author: rguenth
Date: Tue Apr  3 11:55:24 2012
New Revision: 186105

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

    Backport from mainline
    2012-03-06  Richard Guenther  <rguenther@suse.de>

    PR middle-end/52493
    * tree-ssa-alias.c (ptr_derefs_may_alias_p): Robustify.

    * gcc.dg/torture/pr52493.c: New testcase.

    2012-03-23  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/52678
    * tree-vectorizer.h (struct _stmt_vec_info): Add
    loop_phi_evolution_part member.
    (STMT_VINFO_LOOP_PHI_EVOLUTION_PART): New define.
    * tree-vect-loop.c (vect_analyze_scalar_cycles_1): Initialize
    STMT_VINFO_LOOP_PHI_EVOLUTION_PART.
    * tree-vect-loop-manip.c (vect_update_ivs_after_vectorizer):
    Use the cached evolution part and the PHI nodes value from
    the loop preheader edge instead of re-analyzing the evolution.

    * gfortran.dg/pr52678.f: New testcase.

    2012-03-26  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/52701
    * tree-vect-loop.c (vect_analyze_scalar_cycles_1): Always
    compute and set the evolution part of PHI nodes.

    * gfortran.dg/pr52701.f90: New testcase.

    2012-03-30  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/52754
    * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Only
    propagate arbitrary addresses into really plain dereferences.

    * gcc.target/i386/pr52754.c: New testcase.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr52493.c
    branches/gcc-4_7-branch/gcc/testsuite/gcc.target/i386/pr52754.c
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/pr52678.f
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/pr52701.f90
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/gcc/tree-ssa-alias.c
    branches/gcc-4_7-branch/gcc/tree-ssa-forwprop.c
    branches/gcc-4_7-branch/gcc/tree-vect-loop-manip.c
    branches/gcc-4_7-branch/gcc/tree-vect-loop.c
    branches/gcc-4_7-branch/gcc/tree-vectorizer.h


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

* [Bug tree-optimization/52678] [4.7 Regression] internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842
  2012-03-22 21:45 [Bug tree-optimization/52678] New: internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842 utke at mcs dot anl.gov
                   ` (7 preceding siblings ...)
  2012-04-03 11:57 ` rguenth at gcc dot gnu.org
@ 2012-04-03 12:00 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-03 12:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |4.7.1, 4.8.0
         Resolution|                            |FIXED
      Known to fail|                            |4.7.0

--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-03 11:56:31 UTC ---
Fixed.


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

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-22 21:45 [Bug tree-optimization/52678] New: internal compiler error: in vect_update_ivs_after_vectorizer, at tree-vect-loop-manip.c:1842 utke at mcs dot anl.gov
2012-03-23  7:38 ` [Bug tree-optimization/52678] " rguenth at gcc dot gnu.org
2012-03-23  9:30 ` rguenth at gcc dot gnu.org
2012-03-23  9:33 ` rguenth at gcc dot gnu.org
2012-03-23 10:30 ` rguenth at gcc dot gnu.org
2012-03-23 11:40 ` [Bug tree-optimization/52678] [4.7 Regression] " rguenth at gcc dot gnu.org
2012-03-23 12:33 ` rguenth at gcc dot gnu.org
2012-04-03 10:14 ` rguenth at gcc dot gnu.org
2012-04-03 11:57 ` rguenth at gcc dot gnu.org
2012-04-03 12:00 ` 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).