Commit dc215785 by Ulrich Weigand Committed by Ulrich Weigand

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
parent 32fdf2f4
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> 2009-03-11 Jason Merrill <jason@redhat.com>
PR debug/39086 PR debug/39086
......
...@@ -9292,7 +9292,8 @@ fold_comparison (enum tree_code code, tree type, tree op0, tree op1) ...@@ -9292,7 +9292,8 @@ fold_comparison (enum tree_code code, tree type, tree op0, tree op1)
} }
/* Fold comparisons against infinity. */ /* 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); tem = fold_inf_compare (code, type, arg0, arg1);
if (tem != NULL_TREE) if (tem != NULL_TREE)
......
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> 2009-03-11 Olivier Hainque <hainque@adacore.com>
* gnat.dg/slice_enum.adb: New test. * gnat.dg/slice_enum.adb: New test.
......
...@@ -77,7 +77,7 @@ int main() ...@@ -77,7 +77,7 @@ int main()
{ {
test (34.0, __builtin_inf()); test (34.0, __builtin_inf());
testf (34.0f, __builtin_inff()); testf (34.0f, __builtin_inff());
testf (34.0l, __builtin_infl()); testl (34.0l, __builtin_infl());
return 0; return 0;
} }
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;
}
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