This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix PR43065: Insert bounds on pointer type parameters
- From: Sebastian Pop <sebpop at gmail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org, gcc-graphite <gcc-graphite at googlegroups dot com>, "Yazdani, Reza" <reza dot yazdani at amd dot com>, Richard Guenther <rguenther at suse dot de>
- Date: Sat, 6 Mar 2010 01:08:49 -0600
- Subject: Re: [patch] Fix PR43065: Insert bounds on pointer type parameters
- References: <cb9d34b21003051545p6bcb86feq30a88cff87557c96@mail.gmail.com> <201003060146.46371.ebotcazou@adacore.com>
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)
{