On 23/01/16 18:39, Sebastian Pop wrote:
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index a40f40d..7ff5db7 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -1023,6 +1023,10 @@ dr_analyze_indices (struct data_reference *dr,
loop_p nest, loop_p loop)
build_int_cst (reference_alias_ptr_type (ref), 0));
}
+ /* Ensure that DR_NUM_DIMENSIONS (dr) != 0. */
+ if (access_fns == vNULL)
+ access_fns.safe_push (integer_zero_node);
+
DR_BASE_OBJECT (dr) = ref;
DR_ACCESS_FNS (dr) = access_fns;
}
This code adds a data reference with an access function 0 for all data
references
that cannot be analyzed by the data reference analysis. Let's move
this check under
the check for DECL_P (ref) and this fixes the check in graphite:
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index a40f40d..862589b 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -1018,12 +1018,15 @@ dr_analyze_indices (struct data_reference *dr,
loop_p nest, loop_p loop)
else if (DECL_P (ref))
{
/* Canonicalize DR_BASE_OBJECT to MEM_REF form. */
ref = build2 (MEM_REF, TREE_TYPE (ref),
build_fold_addr_expr (ref),
build_int_cst (reference_alias_ptr_type (ref), 0));
+
+ if (access_fns == vNULL)
+ access_fns.safe_push (integer_zero_node);
}
DR_BASE_OBJECT (dr) = ref;
DR_ACCESS_FNS (dr) = access_fns;
}
Ok with this change.
Hi Sebastian,
That was my original patch, and Richard commented: 'I think avoiding a
NULL access_fns is ok but it should be done unconditionally, not only
for the DECL_P case'. In order words, he asked me to do the exact
opposite of the change you now propose.
Thanks,
- Tom