[PATCH 1/2]: Merging meaning of CONVERT_EXPR and NOP_EXPR v.2

Eric Botcazou ebotcazou@adacore.com
Sun Jun 22 13:59:00 GMT 2008


> Index: gcc/ada/trans.c
> ===================================================================
> --- gcc/ada/trans.c	(revision 136584)
> +++ gcc/ada/trans.c	(working copy)
> @@ -6319,10 +6319,9 @@ addressable_p (tree gnu_expr, tree gnu_t
>
>      case ARRAY_REF:  case ARRAY_RANGE_REF:
>      case REALPART_EXPR:  case IMAGPART_EXPR:
> -    case NOP_EXPR:
>        return addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE);
>
> -    case CONVERT_EXPR:
> +    CASE_CONVERT:
>        return (AGGREGATE_TYPE_P (TREE_TYPE (gnu_expr))
>  	      && addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE));

This is not OK.  For example, no-op integral casts would be changed from 
addressable to non-addressable.  See the spec of the predicate:

/* Return true if GNU_EXPR can be directly addressed.  This is the case
   unless it is an expression involving computation or if it involves a
   reference to a bitfield or to an object not sufficiently aligned for
   its type.  If GNU_TYPE is non-null, return true only if GNU_EXPR can
   be directly addressed as an object of this type.

IOW, the predicate must return true if there is no computation involved in the 
conversion.

-- 
Eric Botcazou



More information about the Gcc-patches mailing list