Commit 5f4e6de3 by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/54120 (FAIL: gfortran.fortran-torture/execute/random_2.f90 execution)

	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.

From-SVN: r195007
parent f3ef18ff
2013-01-08 Jakub Jelinek <jakub@redhat.com> 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> Richard Biener <rguenther@suse.de>
PR middle-end/55851 PR middle-end/55851
......
/* Support routines for Value Range Propagation (VRP). /* 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. Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>. Contributed by Diego Novillo <dnovillo@redhat.com>.
...@@ -8753,9 +8753,11 @@ range_fits_type_p (value_range_t *vr, unsigned precision, bool unsigned_p) ...@@ -8753,9 +8753,11 @@ range_fits_type_p (value_range_t *vr, unsigned precision, bool unsigned_p)
&& !POINTER_TYPE_P (src_type)) && !POINTER_TYPE_P (src_type))
return false; 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)); 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 || (src_precision == precision
&& TYPE_UNSIGNED (src_type) == unsigned_p)) && TYPE_UNSIGNED (src_type) == unsigned_p))
return true; return true;
...@@ -8813,7 +8815,7 @@ simplify_float_conversion_using_ranges (gimple_stmt_iterator *gsi, gimple stmt) ...@@ -8813,7 +8815,7 @@ simplify_float_conversion_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
mode = TYPE_MODE (TREE_TYPE (rhs1)); mode = TYPE_MODE (TREE_TYPE (rhs1));
/* If we can do the conversion in the current input mode do nothing. */ /* If we can do the conversion in the current input mode do nothing. */
else if (can_float_p (fltmode, TYPE_MODE (TREE_TYPE (rhs1)), 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; return false;
/* Otherwise search for a mode we can use, starting from the narrowest /* Otherwise search for a mode we can use, starting from the narrowest
integer mode available. */ integer mode available. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment