From 5f4e6de31f84daa0bcaf1c8e388b6eee9bf359b1 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 8 Jan 2013 09:33:43 +0100 Subject: [PATCH] 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 --- gcc/ChangeLog | 9 +++++++++ gcc/tree-vrp.c | 10 ++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 25e60e3..379de4d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,13 @@ 2013-01-08 Jakub Jelinek + + 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 Richard Biener PR middle-end/55851 diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 6b8cbf3..f6b1517 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -1,5 +1,5 @@ /* 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 . @@ -8753,9 +8753,11 @@ range_fits_type_p (value_range_t *vr, unsigned precision, bool unsigned_p) && !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; @@ -8813,7 +8815,7 @@ simplify_float_conversion_using_ranges (gimple_stmt_iterator *gsi, gimple stmt) 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. */ -- 2.7.4