[PATCH] Fix middle-end/30132: ICE with complex and taking the real part of a ?:

Jason Merrill jason@redhat.com
Mon Nov 12 21:28:00 GMT 2007


Andrew Pinski wrote:
>        * typeck.c (build_address): For COND_EXPR, create a?&b:&c instead
>        of the plain &(a?b:c) so we don't get a temp variable in the gimplifier.

What about the other transformations in unary_complex_lvalue?  Or the &* 
optimization?

The problem is that build_address is trying to do something very simple, 
but the name makes it attractive to other parts of the compiler that 
want the address of something without all the diagnostics in 
build_unary_op.  Really it's only safe to call build_address if you know 
that there aren't any tree simplifications to be done on the operand.

I think what we really need is to split out most of the address handling 
in build_unary_op so we can call it with diagnostics on or off, call the 
latter build_address, rename the current build_address to 
build_addr_expr and go through the callers of build_address to see which 
one they really want.

Jason



More information about the Gcc-patches mailing list