fold-const.c (fold_comparison): Only call fold_inf_compare if the mode supports infinities.

ChangeLog:

	* fold-const.c (fold_comparison): Only call fold_inf_compare
	if the mode supports infinities.

testsuite/ChangeLog:

	* gcc.c-torture/execute/ieee/inf-3.c: New test.
	* gcc.c-torture/execute/ieee/inf-2.c: Fix typo.

From-SVN: r144779
This commit is contained in:
Ulrich Weigand 2009-03-11 15:24:00 +00:00 committed by Ulrich Weigand
parent 32fdf2f406
commit dc21578563
5 changed files with 92 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2009-03-11 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* fold-const.c (fold_comparison): Only call fold_inf_compare
if the mode supports infinities.
2009-03-11 Jason Merrill <jason@redhat.com>
PR debug/39086

View File

@ -9292,7 +9292,8 @@ fold_comparison (enum tree_code code, tree type, tree op0, tree op1)
}
/* Fold comparisons against infinity. */
if (REAL_VALUE_ISINF (cst))
if (REAL_VALUE_ISINF (cst)
&& MODE_HAS_INFINITIES (TYPE_MODE (TREE_TYPE (arg1))))
{
tem = fold_inf_compare (code, type, arg0, arg1);
if (tem != NULL_TREE)

View File

@ -1,3 +1,8 @@
2009-03-11 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* gcc.c-torture/execute/ieee/inf-3.c: New test.
* gcc.c-torture/execute/ieee/inf-2.c: Fix typo.
2009-03-11 Olivier Hainque <hainque@adacore.com>
* gnat.dg/slice_enum.adb: New test.

View File

@ -77,7 +77,7 @@ int main()
{
test (34.0, __builtin_inf());
testf (34.0f, __builtin_inff());
testf (34.0l, __builtin_infl());
testl (34.0l, __builtin_infl());
return 0;
}

View File

@ -0,0 +1,79 @@
extern void abort (void);
void test(double f, double i)
{
if (f == __builtin_huge_val())
abort ();
if (f == -__builtin_huge_val())
abort ();
if (i == -__builtin_huge_val())
abort ();
if (i != __builtin_huge_val())
abort ();
if (f >= __builtin_huge_val())
abort ();
if (f > __builtin_huge_val())
abort ();
if (i > __builtin_huge_val())
abort ();
if (f <= -__builtin_huge_val())
abort ();
if (f < -__builtin_huge_val())
abort ();
}
void testf(float f, float i)
{
if (f == __builtin_huge_valf())
abort ();
if (f == -__builtin_huge_valf())
abort ();
if (i == -__builtin_huge_valf())
abort ();
if (i != __builtin_huge_valf())
abort ();
if (f >= __builtin_huge_valf())
abort ();
if (f > __builtin_huge_valf())
abort ();
if (i > __builtin_huge_valf())
abort ();
if (f <= -__builtin_huge_valf())
abort ();
if (f < -__builtin_huge_valf())
abort ();
}
void testl(long double f, long double i)
{
if (f == __builtin_huge_vall())
abort ();
if (f == -__builtin_huge_vall())
abort ();
if (i == -__builtin_huge_vall())
abort ();
if (i != __builtin_huge_vall())
abort ();
if (f >= __builtin_huge_vall())
abort ();
if (f > __builtin_huge_vall())
abort ();
if (i > __builtin_huge_vall())
abort ();
if (f <= -__builtin_huge_vall())
abort ();
if (f < -__builtin_huge_vall())
abort ();
}
int main()
{
test (34.0, __builtin_huge_val());
testf (34.0f, __builtin_huge_valf());
testl (34.0l, __builtin_huge_vall());
return 0;
}