diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 4d2853ca44e24d8593dca794fddafa6b211edf6b..c3d82202becab82435adadd513c611f03ed2aad6 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,4 +1,13 @@ -2010-03-04 Sebastian Pop <sebastian.pop@amd.com> +2010-03-05 Sebastian Pop <sebastian.pop@amd.com> + Reza Yazdani <reza.yazdani@amd.com> + + PR middle-end/43065 + * graphite-sese-to-poly.c (add_param_constraints): Insert bounds + on pointer type parameters. + + * gcc.dg/graphite/run-id-4.c: New. + +2010-03-05 Sebastian Pop <sebastian.pop@amd.com> PR middle-end/43065 * gcc.dg/graphite/run-id-3.c: New. diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 279a905764dfb07062e3fb5bd09cf08184ca218d..89330727337d9e758ef1afb672e2fbe92e492764 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -1499,13 +1499,19 @@ add_param_constraints (scop_p scop, ppl_Polyhedron_t context, graphite_dim_t p) ppl_Linear_Expression_t le; tree parameter = VEC_index (tree, SESE_PARAMS (SCOP_REGION (scop)), p); tree type = TREE_TYPE (parameter); - tree lb, ub; + tree lb = NULL_TREE; + tree ub = NULL_TREE; - if (!INTEGRAL_TYPE_P (type)) - return; - - lb = TYPE_MIN_VALUE (type); - ub = TYPE_MAX_VALUE (type); + if (INTEGRAL_TYPE_P (type)) + { + lb = TYPE_MIN_VALUE (type); + ub = TYPE_MAX_VALUE (type); + } + else if (POINTER_TYPE_P (type)) + { + lb = TYPE_MIN_VALUE (unsigned_type_node); + ub = TYPE_MAX_VALUE (unsigned_type_node); + } if (lb) { diff --git a/gcc/testsuite/gcc.dg/graphite/run-id-4.c b/gcc/testsuite/gcc.dg/graphite/run-id-4.c new file mode 100644 index 0000000000000000000000000000000000000000..143a449d080c29a60b6553be17e461c38a52bd26 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/run-id-4.c @@ -0,0 +1,28 @@ +/* PR rtl-optimization/24899 */ + +extern void abort (void); + +__attribute__ ((noinline)) int +foo (int x, int y, int *z) +{ + int a, b, c, d; + + a = b = 0; + for (d = 0; d < y; d++) + { + if (z) + b = d * *z; + for (c = 0; c < x; c++) + a += b; + } + + return a; +} + +int +main (void) +{ + if (foo (3, 2, 0) != 0) + abort (); + return 0; +}