* fold-const.c (build_range_check): If both low and high are NULL,
use omit_one_operand_loc to preserve exp side-effects.
* gcc.c-torture/execute/pr58385.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202494
138bc75d-0d04-0410-961f-
82ee72b054a4
+2013-09-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/58385
+ * fold-const.c (build_range_check): If both low and high are NULL,
+ use omit_one_operand_loc to preserve exp side-effects.
+
2013-09-11 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/arm/arm.md (arm_shiftsi3): New alternative l/l/M.
}
if (low == 0 && high == 0)
- return build_int_cst (type, 1);
+ return omit_one_operand_loc (loc, type, build_int_cst (type, 1), exp);
if (low == 0)
return fold_build2_loc (loc, LE_EXPR, type, exp,
+2013-09-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/58385
+ * gcc.c-torture/execute/pr58385.c: New test.
+
2013-09-11 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/arm/thumb-ifcvt-2.c: New test.
--- /dev/null
+/* PR tree-optimization/58385 */
+
+extern void abort (void);
+
+int a, b = 1;
+
+int
+foo ()
+{
+ b = 0;
+ return 0;
+}
+
+int
+main ()
+{
+ ((0 || a) & foo () >= 0) <= 1 && 1;
+ if (b)
+ abort ();
+ return 0;
+}