2013-01-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/54120
+ * tree-vrp.c (range_fits_type_p): Don't allow
+ src_precision < precision from signed vr to unsigned_p
+ if vr->min or vr->max is negative.
+ (simplify_float_conversion_using_ranges): Test can_float_p
+ against CODE_FOR_nothing.
+
+2013-01-08 Jakub Jelinek <jakub@redhat.com>
Richard Biener <rguenther@suse.de>
PR middle-end/55851
/* Support routines for Value Range Propagation (VRP).
- Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>.
&& !POINTER_TYPE_P (src_type))
return false;
- /* An extension is always fine, so is an identity transform. */
+ /* An extension is fine unless VR is signed and unsigned_p,
+ and so is an identity transform. */
src_precision = TYPE_PRECISION (TREE_TYPE (vr->min));
- if (src_precision < precision
+ if ((src_precision < precision
+ && !(unsigned_p && !TYPE_UNSIGNED (src_type)))
|| (src_precision == precision
&& TYPE_UNSIGNED (src_type) == unsigned_p))
return true;
mode = TYPE_MODE (TREE_TYPE (rhs1));
/* If we can do the conversion in the current input mode do nothing. */
else if (can_float_p (fltmode, TYPE_MODE (TREE_TYPE (rhs1)),
- TYPE_UNSIGNED (TREE_TYPE (rhs1))))
+ TYPE_UNSIGNED (TREE_TYPE (rhs1))) != CODE_FOR_nothing)
return false;
/* Otherwise search for a mode we can use, starting from the narrowest
integer mode available. */