On Tue, Feb 21, 2012 at 03:06:40PM +0100, Richard Guenther wrote:
> 
> The gimplifier, when forcing a value to a temporary, uses the
> type of the value for that temporary variable, making it for
> example volatile or const, or puts it in a different address-space
> even.  That's odd and not required, we can decay to the main-variant type.

Shouldn't restrict be preserved though?

> 2012-02-21  Richard Guenther  <rguent...@suse.de>
> 
>       PR middle-end/52314
>       * gimplify.c (create_tmp_from_val): Use the main variant type
>       for the type of the temporary we create.
> 
> Index: gcc/gimplify.c
> ===================================================================
> --- gcc/gimplify.c    (revision 184435)
> +++ gcc/gimplify.c    (working copy)
> @@ -504,7 +504,8 @@ create_tmp_reg (tree type, const char *p
>  static inline tree
>  create_tmp_from_val (tree val)
>  {
> -  return create_tmp_var (TREE_TYPE (val), get_name (val));
> +  /* Drop all qualifiers and address-space information from the value type.  
> */
> +  return create_tmp_var (TYPE_MAIN_VARIANT (TREE_TYPE (val)), get_name 
> (val));
>  }
>  
>  /* Create a temporary to hold the value of VAL.  If IS_FORMAL, try to reuse

        Jakub

Reply via email to