diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4d9766b4dba..cd213f4e608 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-05-17 Daniel Berlin + + * tree-ssa-pre.c (find_or_generate_expression): CALL_EXPR + is okay too. + 2005-05-17 Zdenek Dvorak * timevar.def (TV_SCEV_CONST): New timevar. diff --git a/gcc/testsuite/gcc.dg/20050517-1.c b/gcc/testsuite/gcc.dg/20050517-1.c new file mode 100644 index 00000000000..856fda206b5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20050517-1.c @@ -0,0 +1,8 @@ +/* Tree PRE is going to transform this so that it doesn't call cos on the + d = 0 path, and in doing so, it needs to regenerate the cos call. + This was ICE'ing due to an overly strict check on what it knew how + to regenerate. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ffast-math" } */ +double cos(double); +double f(double d, double i, int j) { if (j == 1) d = 0; return d * cos(i); } diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 54cbf639b77..2482a1329cf 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -1467,7 +1467,8 @@ find_or_generate_expression (basic_block block, tree expr, tree stmts) gcc_assert (UNARY_CLASS_P (genop) || BINARY_CLASS_P (genop) || COMPARISON_CLASS_P (genop) - || REFERENCE_CLASS_P (genop)); + || REFERENCE_CLASS_P (genop) + || TREE_CODE (genop) == CALL_EXPR); genop = create_expression_by_pieces (block, genop, stmts); } return genop;