From: Sebastian Pop Date: Mon, 8 Mar 2010 17:49:57 +0000 (+0000) Subject: Fix PR43065: Insert bounds on pointer type parameters. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3640d64c0f932708e15f82ca4ddc15b15ebf4db5;p=gcc.git Fix PR43065: Insert bounds on pointer type parameters. 2010-03-05 Sebastian Pop Reza Yazdani 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. Co-Authored-By: Reza Yazdani From-SVN: r157289 --- diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 4d2853ca44e..c3d82202bec 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,4 +1,13 @@ -2010-03-04 Sebastian Pop +2010-03-05 Sebastian Pop + Reza Yazdani + + 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 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 279a905764d..89330727337 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 00000000000..143a449d080 --- /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; +}