This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]