Commit 2cf099a5 by Roger Sayle Committed by Roger Sayle

re PR middle-end/11984 (ICE with -ffast_math: expected integer_cst, have real_cst)


	PR middle-end/11984
	* fold-const.c (fold <PLUS_EXPR>): Check for integer constant
	operands before calling tree_int_cst_lt when performing associative
	transformations.

	* gcc.dg/20030820-1.c: New test case.

From-SVN: r70618
parent 68ad9159
2003-08-20 Roger Sayle <roger@eyesopen.com>
PR middle-end/11984
* fold-const.c (fold <PLUS_EXPR>): Check for integer constant
operands before calling tree_int_cst_lt when performing associative
transformations.
2003-08-20 Jason Merrill <jason@redhat.com> 2003-08-20 Jason Merrill <jason@redhat.com>
* tree.h (IS_EXPR_CODE_CLASS): Also include 'r' and 's'. * tree.h (IS_EXPR_CODE_CLASS): Also include 'r' and 's'.
......
...@@ -5884,7 +5884,9 @@ fold (tree expr) ...@@ -5884,7 +5884,9 @@ fold (tree expr)
example: ((X*2 + 4) - 8U)/2. */ example: ((X*2 + 4) - 8U)/2. */
if (minus_lit0 && lit0) if (minus_lit0 && lit0)
{ {
if (tree_int_cst_lt (lit0, minus_lit0)) if (TREE_CODE (lit0) == INTEGER_CST
&& TREE_CODE (minus_lit0) == INTEGER_CST
&& tree_int_cst_lt (lit0, minus_lit0))
{ {
minus_lit0 = associate_trees (minus_lit0, lit0, minus_lit0 = associate_trees (minus_lit0, lit0,
MINUS_EXPR, type); MINUS_EXPR, type);
......
2003-08-20 Roger Sayle <roger@eyesopen.com>
PR middle-end/11984
* gcc.dg/20030820-1.c: New test case.
2003-08-20 Nathan Sidwell <nathan@codesourcery.com> 2003-08-20 Nathan Sidwell <nathan@codesourcery.com>
PR c++/11945 PR c++/11945
......
/* PR middle-end/11984 */
/* The following program used to ICE in fold because we didn't check
whether the constants we were reassociating were integer constants
before calling tree_int_cst_lt. */
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math" } */
double f(double x)
{
return 1.0 - x - 0.1;
}
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