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]

Re: [patch] Fix PR43065: Insert bounds on pointer type parameters


On Fri, Mar 5, 2010 at 18:46, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> to solve http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43065 we
>> have to insert in the context of the scop the minimal value of a
>> pointer type parameter. ?I used for this the min and max values
>> of the unsigned type, like this:
>>
>> + ?else if (POINTER_TYPE_P (type))
>> + ? ?{
>> + ? ? ?lb = TYPE_MIN_VALUE (unsigned_type_node);
>> + ? ? ?ub = TYPE_MAX_VALUE (unsigned_type_node);
>> + ? ?}
>
> VRP (adjust_range_with_scev) uses lower_bound_in_type (type, type) and
> upper_bound_in_type (type, type) in this case.
>

Thanks for this suggestion, the way VRP computes the lb and ub
looks more robust.  What about computing them like VRP does?

diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 99d83d6..11bddf8 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -1502,16 +1502,15 @@ add_param_constraints (scop_p scop,
ppl_Polyhedron_t context, graphite_dim_t p)
   tree lb = NULL_TREE;
   tree ub = NULL_TREE;

-  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 (sizetype);
-      ub = TYPE_MAX_VALUE (sizetype);
-    }
+  if (POINTER_TYPE_P (type) || !TYPE_MIN_VALUE (type))
+    lb = lower_bound_in_type (type, type);
+  else
+    lb = TYPE_MIN_VALUE (type);
+
+  if (POINTER_TYPE_P (type) || !TYPE_MAX_VALUE (type))
+    ub = upper_bound_in_type (type, type);
+  else
+    ub = TYPE_MAX_VALUE (type);

   if (lb)
     {


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