This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] PR20474 fix vectorizer ice





We passed the type_size of a void type to fold_convert, and ICEd. This is
now avoided by the COMPLETE_TYPE_P check.
In addition, we were checking the type_size of the wrong pointer - we have
an indirect-ref access through a pointer p with access_function
(init,+,step), and we want to make sure that:
step == type_size (tree_type (tree_type (p))),
but instead we check that
step == type_size (tree_type (tree_type (init))).
This is also fixed below.

bootstrapped and tested on powerpc-darwin and i686-pc-linux-gnu.

ok for mainline?
this bug is also preset in 4.0. ok for 4.0 too?

thanks,
dorit

      * tree-vect-analyze.c (vect_analyze_pointer_ref_access): Check the
size_type
      of the relevant pointer. Check for COMPLETE_TYPE_P.


*** /Users/dorit/mainline_cvs/gcc/gcc/tree-vect-analyze.c       Thu Mar 17
13:54:07 2005
--- ./tree-vect-analyze.c       Thu Mar 17 17:51:31 2005
*************** vect_analyze_pointer_ref_access (tree me
*** 1401,1408 ****
        return NULL;
      }

!   reftype = TREE_TYPE (init);
!   if (!POINTER_TYPE_P (reftype))
      {
        if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS,
                                LOOP_LOC (loop_vinfo)))
--- 1401,1407 ----
        return NULL;
      }

!   if (!POINTER_TYPE_P (TREE_TYPE (init)))
      {
        if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS,
                                LOOP_LOC (loop_vinfo)))
*************** vect_analyze_pointer_ref_access (tree me
*** 1412,1417 ****
--- 1411,1424 ----

    *ptr_step = fold_convert (ssizetype, step);
    innertype = TREE_TYPE (reftype);
+   if (!COMPLETE_TYPE_P (innertype))
+     {
+       if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS,
+                               LOOP_LOC (loop_vinfo)))
+       fprintf (vect_dump, "not vectorized: pointer to incomplete type.");
+       return NULL;
+     }
+
    /* Check that STEP is a multiple of type size.  */
    if (!integer_zerop (size_binop (TRUNC_MOD_EXPR, *ptr_step,
                        fold_convert (ssizetype, TYPE_SIZE_UNIT
(innertype)))))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]