From b9ba01a11f30733eb45554f8820d4084724d308c Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Wed, 25 Jun 2003 03:09:06 +0000 Subject: [PATCH] re PR rtl-optimization/11311 (ICE with pow and large exponent) PR optimization/11311 * builtins.c (powi_cost): Fix typo. The number of multiplications required is the number to reduce the argument, result, plus the cost of calculating the residual, val [not n, the original value]. * gcc.c-torture/compile/20030624-1.c: New test case. From-SVN: r68452 --- gcc/ChangeLog | 7 +++++++ gcc/builtins.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.c-torture/compile/20030624-1.c | 6 ++++++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/20030624-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9163bb291949..e0bfc15586a6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2003-06-24 Roger Sayle + + PR optimization/11311 + * builtins.c (powi_cost): Fix typo. The number of multiplications + required is the number to reduce the argument, result, plus the + cost of calculating the residual, val [not n, the original value]. + 2003-06-24 Roger Sayle * config/alpha/osf5.h (TARGET_C99_FUNCTIONS): Define. diff --git a/gcc/builtins.c b/gcc/builtins.c index 372c0c2f4371..3c4268fd62d4 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2068,7 +2068,7 @@ powi_cost (HOST_WIDE_INT n) } } - return result + powi_lookup_cost (n, cache); + return result + powi_lookup_cost (val, cache); } /* Recursive subroutine of expand_powi. This function takes the array, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2b8cff0ef363..b2497a35228e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-06-24 Roger Sayle + + * gcc.c-torture/compile/20030624-1.c: New test case. + 2003-06-24 Jakub Jelinek * gcc.c-torture/execute/string-opt-17.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/20030624-1.c b/gcc/testsuite/gcc.c-torture/compile/20030624-1.c new file mode 100644 index 000000000000..9c293fc34fdf --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030624-1.c @@ -0,0 +1,6 @@ +/* Derived from PR optimization/11311 */ + +double pow(double, double); + +double foo(double x) { return pow(x,261); } + -- 2.47.3