/* And these are the types of the expressions. */
tree lhs_type = type;
tree rhs_type = type;
+ int save = 0;
if (cond_first_p)
{
if an arm is a COND_EXPR since we get exponential behavior
in that case. */
- if (TREE_CODE (arg) != SAVE_EXPR && ! TREE_CONSTANT (arg)
- && global_bindings_p () == 0
- && ((TREE_CODE (arg) != VAR_DECL
- && TREE_CODE (arg) != PARM_DECL)
- || TREE_SIDE_EFFECTS (arg)))
+ if (TREE_CODE (arg) == SAVE_EXPR)
+ save = 1;
+ else if (! TREE_CONSTANT (arg)
+ && global_bindings_p () == 0
+ && ((TREE_CODE (arg) != VAR_DECL && TREE_CODE (arg) != PARM_DECL)
+ || TREE_SIDE_EFFECTS (arg)))
{
if (TREE_CODE (true_value) != COND_EXPR)
lhs = fold (build (lhs_code, lhs_type, *true_lhs, *true_rhs));
if ((lhs == 0 || ! TREE_CONSTANT (lhs))
&& (rhs == 0 || !TREE_CONSTANT (rhs)))
- arg = save_expr (arg), lhs = rhs = 0;
+ {
+ arg = save_expr (arg);
+ lhs = rhs = 0;
+ save = 1;
+ }
}
if (lhs == 0)
test = fold (build (COND_EXPR, type, test, lhs, rhs));
- if (TREE_CODE (arg) == SAVE_EXPR)
+ if (save)
return build (COMPOUND_EXPR, type,
convert (void_type_node, arg),
strip_compound_expr (test, arg));
+2002-10-22 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/7209
+ * g++.dg/expr: New directory.
+ * g++.dg/expr/cond1.C: New test.
+
2002-10-21 Zack Weinberg <zack@codesourcery.com>
* gcc.dg/noncompile/920923-1.c: Prevent spurious regressions with