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: PR26197 (new_type_alias) fix


Ian Lance Taylor wrote:
> Dorit Nuzman <DORIT@il.ibm.com> writes:
> 
>> Index: tree-ssa-alias.c
>> ===================================================================
>> *** tree-ssa-alias.c	(revision 115685)
>> --- tree-ssa-alias.c	(working copy)
>> *************** static void create_global_var (void);
>> *** 114,119 ****
>> --- 114,120 ----
>>   static void maybe_create_global_var (struct alias_info *ai);
>>   static void group_aliases (struct alias_info *);
>>   static void set_pt_anything (tree ptr);
>> + static tree add_may_alias_for_new_tag (tree tag, tree var);
>>   
>>   /* Global declarations.  */
> 
> The current gcc convention is to define static functions before their
> use, where possible, and to not bother with an explicit declaration.
> That is, you should omit this declaration, and move the definition of
> add_may_alias_for_new_tag before new_type_alias.
> 
> 
>> +   ref = get_ref_base_and_extent (expr, &offset, &size, &maxsize);
>> +   if (ref == NULL_TREE)
>> +     ref = var;
> 
> Here you allow for the possibility that EXPR does not have a base and
> extent which can be determined.

Which is true.

> 
>>         for (sv = svars; sv; sv = sv->next)
>>   	{
>> !           bool exact;
>>   
>> !           if (overlap_subvar (offset, maxsize, sv->var, &exact))
>> !             VEC_safe_push (tree, heap, overlaps, sv->var);
>> !         }
> 
> Here you seem to assume that OFFSET and MAXSIZE will always be set
> correctly.  It seems to me that in the case where
> get_ref_base_and_extent returns NULL_TREE, then OFFSET and MAXSIZE
> will be such that overlap_subvar will always return false. 

Which is false.
if get_ref_base_and_extent returns NULL_TREE, offset will always be 0,
and maxsize/pmaxsize will be -1.

Anyway given the inputs to get_ref_base_and_extent she is using, you can
assert non-nullness of the result. It can't return NULL if you give it a
valid var or component ref, AFAICT.

We certainly assume this in other uses.
--Dan


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