Index: testsuite/gcc.c-torture/compile/complex-5.c =================================================================== --- testsuite/gcc.c-torture/compile/complex-5.c (revision 0) +++ testsuite/gcc.c-torture/compile/complex-5.c (revision 0) @@ -0,0 +1,13 @@ +/* PR 30132 */ +#define complex _Complex +void testit(double complex* t, double* b) +{ + b[0] = t[0]==0.0?0.0:-t[0]; +} + +main(void) +{ + static double complex k = 5; + static double b; + testit(&k,&b); +} Index: cp/typeck.c =================================================================== --- cp/typeck.c (revision 122896) +++ cp/typeck.c (working copy) @@ -4060,6 +4060,14 @@ build_address (tree t) if (error_operand_p (t) || !cxx_mark_addressable (t)) return error_mark_node; + if (TREE_CODE (t) == COND_EXPR) + { + tree ptrtype = build_pointer_type (TREE_TYPE (t)); + return build3 (COND_EXPR, ptrtype, TREE_OPERAND (t, 0), + build_address (TREE_OPERAND (t, 1)), + build_address (TREE_OPERAND (t, 2))); + } + addr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t); return addr; Index: gimplify.c =================================================================== --- gimplify.c (revision 122896) +++ gimplify.c (working copy) @@ -2436,7 +2436,7 @@ gimplify_cond_expr (tree *expr_p, tree * { tree result; - if ((fallback & fb_lvalue) == 0) + if (fallback != fb_lvalue) { result = tmp2 = tmp = create_tmp_var (TREE_TYPE (expr), "iftmp"); ret = GS_ALL_DONE; @@ -3948,6 +3948,15 @@ gimplify_addr_expr (tree *expr_p, tree * if (TREE_CODE (op0) == INDIRECT_REF) goto do_indirect_ref; + /* If we don't already have an addressable expression, create a new + decl to hold it so we don't get non gimple as the decl which was + holding this before was not marked as addressable already. */ + if (TREE_CODE (op0) == VAR_DECL + && DECL_GIMPLE_FORMAL_TEMP_P (op0) + && !TREE_ADDRESSABLE (op0)) + TREE_OPERAND (expr, 0) = get_initialized_tmp_var (op0, pre_p, + post_p); + /* Make sure TREE_INVARIANT, TREE_CONSTANT, and TREE_SIDE_EFFECTS is set properly. */ recompute_tree_invariant_for_addr_expr (expr);