+2010-11-19 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/46547
+ * c-common.c (in_late_binary_op): Define.
+ (c_common_truthvalue_conversion): Check in_late_binary_op before
+ calling c_save_expr.
+ * c-common.h (in_late_binary_op): Declare.
+ * c-tree.h (in_late_binary_op): Move to c-common.h.
+ * c-typeck.c (in_late_binary_op): Move to c-common.c.
+
2010-11-17 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46498
executed. */
int c_inhibit_evaluation_warnings;
+/* Whether we are building a boolean conversion inside
+ convert_for_assignment, or some other late binary operation. If
+ build_binary_op is called for C (from code shared by C and C++) in
+ this case, then the operands have already been folded and the
+ result will not be folded again, so C_MAYBE_CONST_EXPR should not
+ be generated. */
+bool in_late_binary_op;
+
/* Whether lexing has been completed, so subsequent preprocessor
errors should use the compiler's input_location. */
bool done_lexing = false;
if (TREE_CODE (TREE_TYPE (expr)) == COMPLEX_TYPE)
{
- tree t = c_save_expr (expr);
+ tree t = (in_late_binary_op ? save_expr (expr) : c_save_expr (expr));
expr = (build_binary_op
(EXPR_LOCATION (expr),
(TREE_SIDE_EFFECTS (expr)
extern tree (*make_fname_decl) (location_t, tree, int);
+extern bool in_late_binary_op;
extern const char *c_addr_space_name (addr_space_t as);
extern tree identifier_global_value (tree);
extern void record_builtin_type (enum rid, const char *, tree);
((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
/* in c-typeck.c */
-extern bool in_late_binary_op;
extern int in_alignof;
extern int in_sizeof;
extern int in_typeof;
ic_return
};
-/* Whether we are building a boolean conversion inside
- convert_for_assignment, or some other late binary operation. If
- build_binary_op is called (from code shared with C++) in this case,
- then the operands have already been folded and the result will not
- be folded again, so C_MAYBE_CONST_EXPR should not be generated. */
-bool in_late_binary_op;
-
/* The level of nesting inside "__alignof__". */
int in_alignof;
+2010-11-19 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/46547
+ * gcc.c-torture/compile/pr46547-1.c: New test.
+
2010-11-16 Eric Botcazou <ebotcazou@adacore.com>
* gcc.target/rx/pack.c: New test.
--- /dev/null
+void foo (void) {
+ _Bool d;
+ long double _Complex *s;
+
+ d = *s++;
+}