[PATCH] Fix PR38880, fold &CST->x to a constant

Ian Lance Taylor iant@google.com
Thu Jan 29 16:01:00 GMT 2009


Richard Guenther <rguenther@suse.de> writes:

> Index: gcc/cp/typeck.c
> ===================================================================
> *** gcc/cp/typeck.c.orig	2009-01-20 10:14:28.000000000 +0100
> --- gcc/cp/typeck.c	2009-01-29 11:04:47.000000000 +0100
> *************** build_address (tree t)
> *** 4168,4174 ****
>     if (error_operand_p (t) || !cxx_mark_addressable (t))
>       return error_mark_node;
>   
> !   addr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t);
>   
>     return addr;
>   }
> --- 4168,4174 ----
>     if (error_operand_p (t) || !cxx_mark_addressable (t))
>       return error_mark_node;
>   
> !   addr = fold_build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t);
>   
>     return addr;
>   }

Couldn't this just call build_fold_addr_expr?

However, the comment on the function makes clear that the function is
not supposed to do any simplifications.  And, even if it did, I think
it would have to use fold_if_not_in_template.  I suspect that this is
not the right place for this change.

Ian



More information about the Gcc-patches mailing list