Aliasing violation generated by fold_builtin_memcmp?

Richard Henderson rth@redhat.com
Sat Oct 1 00:11:00 GMT 2005


On Fri, Sep 30, 2005 at 01:49:59PM -0400, Andrew Pinski wrote:
> Something like this will fix the issue with TYPE_REF_CAN_ALIAS_ALL
> by removing the use.  Maybe we could move may_alias to a bit in the
> types and move TYPE_REF_CAN_ALIAS_ALL from the pointer type to the
> type which is being accessed instead of this mess.

Close.  

> +	build_type_attribute_variant (ttype,
> +				      merge_attributes
> +				        (TYPE_ATTRIBUTES (to_type), 
> +					 tree_cons (get_identifier ("may_alias"),
> +						    NULL_TREE, NULL_TREE)));

If ALIAS_SET had been computed on ttype, this will leave it set.
You'd need to force set it to zero here.  You can also avoid 
creating a new type for C for the case in question by checking 
that the original type has alias set zero.

>        return build_pointer_type_for_mode (build_type_no_quals (TREE_TYPE (t)),
>  					  TYPE_MODE (t),
> -					  TYPE_REF_CAN_ALIAS_ALL (t));
> +					  false);

You'd also want to delete all traces of TYPE_REF_CAN_ALIAS_ALL.


r~



More information about the Gcc mailing list