PR tree-optimization/27331
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Jun 2006 10:26:45 +0000 (10:26 +0000)
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Jun 2006 10:26:45 +0000 (10:26 +0000)
* tree-data-ref.c (free_data_ref): New function.
(create_data_ref): Fail if the data reference has unknown access
function.
(free_data_refs): Use free_data_ref.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114810 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr27331.c [new file with mode: 0644]
gcc/tree-data-ref.c

index 3948911..aec8a3f 100644 (file)
@@ -1,3 +1,11 @@
+2006-06-20  Zdenek Dvorak <dvorakz@suse.cz>
+
+       PR tree-optimization/27331
+       * tree-data-ref.c (free_data_ref): New function.
+       (create_data_ref): Fail if the data reference has unknown access
+       function.
+       (free_data_refs): Use free_data_ref.
+
 2006-06-19  Andrew Pinski  <pinskia@gmail.com>
 
        PR middle-end/28075
index 71bd235..5491dbe 100644 (file)
@@ -1,5 +1,10 @@
+2006-06-20  Zdenek Dvorak <dvorakz@suse.cz>
+
+       PR tree-optimization/27331
+       * gcc.dg/pr27331.c: New test.
+
 2006-06-20  James A. Morrison  <phython@gcc.gnu.org>
-            Eric Botcazou  <ebotcazou@adacore.com>
+           Eric Botcazou  <ebotcazou@adacore.com>
 
        PR ada/18692
        * lib/gnat.exp: New file.
diff --git a/gcc/testsuite/gcc.dg/pr27331.c b/gcc/testsuite/gcc.dg/pr27331.c
new file mode 100644 (file)
index 0000000..9b5c71e
--- /dev/null
@@ -0,0 +1,56 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize" } */
+
+struct funny_match
+{
+  int this, other;
+};
+
+typedef struct rtx {
+    int code;
+} *rtx;
+
+extern rtx recog_operand[];
+extern int which_alternative;
+extern int nalternatives;
+
+int
+constrain_operands (insn_code_num, strict)
+     int insn_code_num;
+     int strict;
+{
+  char *constraints[10];
+  struct funny_match funny_match[10];
+  register int c;
+  int funny_match_index;
+
+  which_alternative = 0;
+
+  while (which_alternative < nalternatives)
+    {
+      register int opno;
+      register char *p = constraints[opno];
+      int lose = 0;
+      funny_match_index = 0;
+
+      while (*p && (c = *p++) != ',')
+       funny_match[funny_match_index++].other = c - '0';
+
+      if ((((recog_operand[opno])->code) == 12))
+       lose = 1;
+
+      if (!lose)
+       {
+         while (--funny_match_index >= 0)
+           recog_operand[funny_match[funny_match_index].other]
+                   = recog_operand[funny_match[funny_match_index].this];
+         return 1;
+       }
+      which_alternative++;
+    }
+
+  if (strict == 0)
+    return constrain_operands (insn_code_num, -1);
+  return 0;
+}
+
index 57b1ac0..d3758ef 100644 (file)
@@ -1854,6 +1854,18 @@ analyze_offset (tree offset, tree *invariant, tree *constant)
     *invariant = invariant_0 ? invariant_0 : invariant_1;
 }
 
+/* Free the memory used by the data reference DR.  */
+
+static void
+free_data_ref (data_reference_p dr)
+{
+  if (DR_TYPE(dr) == ARRAY_REF_TYPE)
+    VEC_free (tree, heap, dr->object_info.access_fns);
+  else
+    VEC_free (tree, heap, dr->first_location.access_fns);
+
+  free (dr);
+}
 
 /* Function create_data_ref.
    
@@ -1954,11 +1966,23 @@ create_data_ref (tree memref, tree stmt, bool is_read)
 
       /* Update access function.  */
       access_fn = DR_ACCESS_FN (dr, 0);
+      if (automatically_generated_chrec_p (access_fn))
+       {
+         free_data_ref (dr);
+         return NULL;
+       }
+
       new_step = size_binop (TRUNC_DIV_EXPR,  
                             fold_convert (ssizetype, step), type_size);
 
       init_cond = chrec_convert (chrec_type (access_fn), init_cond, stmt);
       new_step = chrec_convert (chrec_type (access_fn), new_step, stmt);
+      if (automatically_generated_chrec_p (init_cond)
+         || automatically_generated_chrec_p (new_step))
+       {
+         free_data_ref (dr);
+         return NULL;
+       }
       access_fn = chrec_replace_initial_condition (access_fn, init_cond);
       access_fn = reset_evolution_in_loop (loop->num, access_fn, new_step);
 
@@ -4373,14 +4397,7 @@ free_data_refs (VEC (data_reference_p, heap) *datarefs)
   struct data_reference *dr;
 
   for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
-    {
-      if (DR_TYPE(dr) == ARRAY_REF_TYPE)
-       VEC_free (tree, heap, (dr)->object_info.access_fns);
-      else
-       VEC_free (tree, heap, (dr)->first_location.access_fns);
-
-      free (dr);
-    }
+    free_data_ref (dr);
   VEC_free (data_reference_p, heap, datarefs);
 }