Commit 635b0b0c by Richard Sandiford Committed by Richard Sandiford

tree-vrp.c (range_fits_type_p): Require the MSB of the double_int to be clear for sign changes.

gcc/
	* tree-vrp.c (range_fits_type_p): Require the MSB of the double_int
	to be clear for sign changes.

gcc/testsuite/
	* gcc.dg/torture/fp-int-convert-2.c: New test.

From-SVN: r194800
parent 4ff4293f
2013-01-02 Richard Sandiford <rdsandiford@googlemail.com>
* tree-vrp.c (range_fits_type_p): Require the MSB of the double_int
to be clear for sign changes.
2013-01-01 Jan Hubicka <jh@suse.cz>
* ipa-inline-analysis.c: Fix formatting.
2013-01-02 Richard Sandiford <rdsandiford@googlemail.com>
* gcc.dg/torture/fp-int-convert-2.c: New test.
2013-01-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* gfortran.dg/newunit_3.f90: Add dg-do run.
......
/* { dg-do run } */
/* { dg-require-effective-target int128 } */
extern void abort (void);
float __attribute__((noinline))
f (__uint128_t x)
{
return x + 1;
}
int
main (void)
{
if (f (0xffffffffu) == 0)
abort ();
return 0;
}
......@@ -8766,9 +8766,11 @@ range_fits_type_p (value_range_t *vr, unsigned precision, bool unsigned_p)
|| TREE_CODE (vr->max) != INTEGER_CST)
return false;
/* For precision-preserving sign-changes the MSB of the double-int
has to be clear. */
if (src_precision == precision
/* For sign changes, the MSB of the double_int has to be clear.
An unsigned value with its MSB set cannot be represented by
a signed double_int, while a negative value cannot be represented
by an unsigned double_int. */
if (TYPE_UNSIGNED (src_type) != unsigned_p
&& (TREE_INT_CST_HIGH (vr->min) | TREE_INT_CST_HIGH (vr->max)) < 0)
return false;
......
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