PR tree-optimization/66894
* tree-vrp.c (register_edge_assert_for_2): Fix bad assumption
about deriving NE_EXPR from truncated values.
* gcc.dg/torture/pr66894.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225870
138bc75d-0d04-0410-961f-
82ee72b054a4
+2015-07-16 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/66894
+ * tree-vrp.c (register_edge_assert_for_2): Fix bad assumption
+ about deriving NE_EXPR from truncated values.
+
2015-07-16 Martin Liska <mliska@suse.cz>
* alloc-pool.h
+2015-07-16 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/66894
+ * gcc.dg/torture/pr66894.c: New testcase.
+
2015-07-16 Richard Biener <rguenther@suse.de>
* gcc.dg/tree-ssa/pr21031.c: Adjust.
--- /dev/null
+/* { dg-do run } */
+
+short a, b;
+
+int
+main ()
+{
+ for (; a != 1; a += 3)
+ {
+ int c = 0;
+ for (; c < 2; c++)
+ if (a)
+ {
+ char d = a;
+ b = d ? 1 / d : 0;
+ }
+ else
+ break;
+ }
+ return 0;
+}
}
else if (CONVERT_EXPR_CODE_P (code))
{
- /* For truncating conversions require that the constant
- fits in the truncated type if we are going to record
+ /* For truncating conversions we cannot record
an inequality. */
if (comp_code == NE_EXPR
&& (TYPE_PRECISION (TREE_TYPE (name2))
- < TYPE_PRECISION (TREE_TYPE (name)))
- && ! int_fits_type_p (val, TREE_TYPE (name2)))
+ < TYPE_PRECISION (TREE_TYPE (name))))
continue;
cst = fold_convert (TREE_TYPE (name2), val);
}