This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran,patch] Fix constant exponentiation with integer exponent
- From: FX Coudert <fxcoudert at gmail dot com>
- To: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 19 Mar 2007 23:59:32 +0100
- Subject: [gfortran,patch] Fix constant exponentiation with integer exponent
Hi all,
This is a patch to fix PR 30834 by rewriting large parts of the
complex_pow and gfc_arith_power functions (in arith.c) so that they
handled arbitrarily large numbers (in mpz_t form). Complex
exponentation is now done using the binary methode, like in the
library. Real exponentiation is a simple call to mpfr_pow_z().
Integer exponentiation needs more thinking, and I had to write many
cases to get it right every single time (integer exponentiation with
negative exponents shouldn't be allowed, let me tell you!)
The patch comes with somewhat long testcases. Regtested on i686-
linux, OK for mainline? Do you think it's OK for 4.2? (I'm not sure,
it's rather invasive... and the cases where the compiler actually got
it wrong were... rather rarely used)
FX
:ADDPATCH fortran:
Attachment:
pr30834_3.ChangeLog
Description: Binary data
Attachment:
pr30834_3.diff
Description: Binary data