diff options
author | Thomas Koenig <Thomas.Koenig@online.de> | 2007-03-04 08:03:34 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2007-03-04 08:03:34 +0000 |
commit | 3d1f465aff3484eafd4e10e38bc7f7331a43d0dd (patch) | |
tree | a61d8416540e00b4c26389a23d6836b40ab750f5 /libgfortran | |
parent | dda10672f1a0f505dd6f8133a5483b8ee846f233 (diff) | |
download | gcc-3d1f465aff3484eafd4e10e38bc7f7331a43d0dd.zip gcc-3d1f465aff3484eafd4e10e38bc7f7331a43d0dd.tar.gz gcc-3d1f465aff3484eafd4e10e38bc7f7331a43d0dd.tar.bz2 |
re PR fortran/30981 ([4.1 only] a ** exp fails for integer exponents if exp is "-huge()-1" (endless loop))
2007-03-04 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/30981
* m4/pow_m4: Use appropriate unsigned int type for u.
* generated/pow_c10_i16.c: Regenerated.
* generated/pow_c10_i4.c: Regenerated.
* generated/pow_c10_i8.c: Regenerated.
* generated/pow_c16_i16.c: Regenerated.
* generated/pow_c16_i4.c: Regenerated.
* generated/pow_c16_i8.c: Regenerated.
* generated/pow_c4_i16.c: Regenerated.
* generated/pow_c4_i4.c: Regenerated.
* generated/pow_c4_i8.c: Regenerated.
* generated/pow_c8_i16.c: Regenerated.
* generated/pow_c8_i4.c: Regenerated.
* generated/pow_c8_i8.c: Regenerated.
* generated/pow_i16_i16.c: Regenerated.
* generated/pow_i16_i4.c: Regenerated.
* generated/pow_i16_i8.c: Regenerated.
* generated/pow_i4_i16.c: Regenerated.
* generated/pow_i4_i4.c: Regenerated.
* generated/pow_i4_i8.c: Regenerated.
* generated/pow_i8_i16.c: Regenerated.
* generated/pow_i8_i4.c: Regenerated.
* generated/pow_i8_i8.c: Regenerated.
* generated/pow_r10_i16.c: Regenerated.
* generated/pow_r10_i4.c: Regenerated.
* generated/pow_r10_i8.c: Regenerated.
* generated/pow_r16_i16.c: Regenerated.
* generated/pow_r16_i4.c: Regenerated.
* generated/pow_r16_i8.c: Regenerated.
* generated/pow_r4_i16.c: Regenerated.
* generated/pow_r4_i4.c: Regenerated.
* generated/pow_r4_i8.c: Regenerated.
* generated/pow_r8_i16.c: Regenerated.
* generated/pow_r8_i4.c: Regenerated.
* generated/pow_r8_i8.c: Regenerated.
2007-03-04 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/30981
* gfortran.dg/integer_exponentiation_1.f90: New test.
From-SVN: r122522
Diffstat (limited to 'libgfortran')
35 files changed, 267 insertions, 93 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index cfa42b2..ad71a7e 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,41 @@ +2007-03-04 Thomas Koenig <Thomas.Koenig@online.de> + + PR libfortran/30981 + * m4/pow_m4: Use appropriate unsigned int type for u. + * generated/pow_c10_i16.c: Regenerated. + * generated/pow_c10_i4.c: Regenerated. + * generated/pow_c10_i8.c: Regenerated. + * generated/pow_c16_i16.c: Regenerated. + * generated/pow_c16_i4.c: Regenerated. + * generated/pow_c16_i8.c: Regenerated. + * generated/pow_c4_i16.c: Regenerated. + * generated/pow_c4_i4.c: Regenerated. + * generated/pow_c4_i8.c: Regenerated. + * generated/pow_c8_i16.c: Regenerated. + * generated/pow_c8_i4.c: Regenerated. + * generated/pow_c8_i8.c: Regenerated. + * generated/pow_i16_i16.c: Regenerated. + * generated/pow_i16_i4.c: Regenerated. + * generated/pow_i16_i8.c: Regenerated. + * generated/pow_i4_i16.c: Regenerated. + * generated/pow_i4_i4.c: Regenerated. + * generated/pow_i4_i8.c: Regenerated. + * generated/pow_i8_i16.c: Regenerated. + * generated/pow_i8_i4.c: Regenerated. + * generated/pow_i8_i8.c: Regenerated. + * generated/pow_r10_i16.c: Regenerated. + * generated/pow_r10_i4.c: Regenerated. + * generated/pow_r10_i8.c: Regenerated. + * generated/pow_r16_i16.c: Regenerated. + * generated/pow_r16_i4.c: Regenerated. + * generated/pow_r16_i8.c: Regenerated. + * generated/pow_r4_i16.c: Regenerated. + * generated/pow_r4_i4.c: Regenerated. + * generated/pow_r4_i8.c: Regenerated. + * generated/pow_r8_i16.c: Regenerated. + * generated/pow_r8_i4.c: Regenerated. + * generated/pow_r8_i8.c: Regenerated. + 2007-03-03 Francois-Xavier Coudert <coudert@clipper.ens.fr> PR libfortran/31001 diff --git a/libgfortran/generated/pow_c10_i16.c b/libgfortran/generated/pow_c10_i16.c index 6332013..c62d5f4 100644 --- a/libgfortran/generated/pow_c10_i16.c +++ b/libgfortran/generated/pow_c10_i16.c @@ -45,7 +45,8 @@ GFC_COMPLEX_10 pow_c10_i16 (GFC_COMPLEX_10 a, GFC_INTEGER_16 b) { GFC_COMPLEX_10 pow, x; - GFC_INTEGER_16 n, u; + GFC_INTEGER_16 n; + GFC_UINTEGER_16 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_c10_i16 (GFC_COMPLEX_10 a, GFC_INTEGER_16 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_c10_i4.c b/libgfortran/generated/pow_c10_i4.c index ccb1a0c..aca3e7f 100644 --- a/libgfortran/generated/pow_c10_i4.c +++ b/libgfortran/generated/pow_c10_i4.c @@ -45,7 +45,8 @@ GFC_COMPLEX_10 pow_c10_i4 (GFC_COMPLEX_10 a, GFC_INTEGER_4 b) { GFC_COMPLEX_10 pow, x; - GFC_INTEGER_4 n, u; + GFC_INTEGER_4 n; + GFC_UINTEGER_4 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_c10_i4 (GFC_COMPLEX_10 a, GFC_INTEGER_4 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_c10_i8.c b/libgfortran/generated/pow_c10_i8.c index 0f2b242..a4a9452 100644 --- a/libgfortran/generated/pow_c10_i8.c +++ b/libgfortran/generated/pow_c10_i8.c @@ -45,7 +45,8 @@ GFC_COMPLEX_10 pow_c10_i8 (GFC_COMPLEX_10 a, GFC_INTEGER_8 b) { GFC_COMPLEX_10 pow, x; - GFC_INTEGER_8 n, u; + GFC_INTEGER_8 n; + GFC_UINTEGER_8 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_c10_i8 (GFC_COMPLEX_10 a, GFC_INTEGER_8 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_c16_i16.c b/libgfortran/generated/pow_c16_i16.c index a6d8883..d05580f 100644 --- a/libgfortran/generated/pow_c16_i16.c +++ b/libgfortran/generated/pow_c16_i16.c @@ -45,7 +45,8 @@ GFC_COMPLEX_16 pow_c16_i16 (GFC_COMPLEX_16 a, GFC_INTEGER_16 b) { GFC_COMPLEX_16 pow, x; - GFC_INTEGER_16 n, u; + GFC_INTEGER_16 n; + GFC_UINTEGER_16 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_c16_i16 (GFC_COMPLEX_16 a, GFC_INTEGER_16 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_c16_i4.c b/libgfortran/generated/pow_c16_i4.c index d396052..b0576c5 100644 --- a/libgfortran/generated/pow_c16_i4.c +++ b/libgfortran/generated/pow_c16_i4.c @@ -45,7 +45,8 @@ GFC_COMPLEX_16 pow_c16_i4 (GFC_COMPLEX_16 a, GFC_INTEGER_4 b) { GFC_COMPLEX_16 pow, x; - GFC_INTEGER_4 n, u; + GFC_INTEGER_4 n; + GFC_UINTEGER_4 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_c16_i4 (GFC_COMPLEX_16 a, GFC_INTEGER_4 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_c16_i8.c b/libgfortran/generated/pow_c16_i8.c index 0a0e94d..3d99160 100644 --- a/libgfortran/generated/pow_c16_i8.c +++ b/libgfortran/generated/pow_c16_i8.c @@ -45,7 +45,8 @@ GFC_COMPLEX_16 pow_c16_i8 (GFC_COMPLEX_16 a, GFC_INTEGER_8 b) { GFC_COMPLEX_16 pow, x; - GFC_INTEGER_8 n, u; + GFC_INTEGER_8 n; + GFC_UINTEGER_8 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_c16_i8 (GFC_COMPLEX_16 a, GFC_INTEGER_8 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_c4_i16.c b/libgfortran/generated/pow_c4_i16.c index 1085ad2..84309ff 100644 --- a/libgfortran/generated/pow_c4_i16.c +++ b/libgfortran/generated/pow_c4_i16.c @@ -45,7 +45,8 @@ GFC_COMPLEX_4 pow_c4_i16 (GFC_COMPLEX_4 a, GFC_INTEGER_16 b) { GFC_COMPLEX_4 pow, x; - GFC_INTEGER_16 n, u; + GFC_INTEGER_16 n; + GFC_UINTEGER_16 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_c4_i16 (GFC_COMPLEX_4 a, GFC_INTEGER_16 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_c4_i4.c b/libgfortran/generated/pow_c4_i4.c index ca37671..35597d0 100644 --- a/libgfortran/generated/pow_c4_i4.c +++ b/libgfortran/generated/pow_c4_i4.c @@ -45,7 +45,8 @@ GFC_COMPLEX_4 pow_c4_i4 (GFC_COMPLEX_4 a, GFC_INTEGER_4 b) { GFC_COMPLEX_4 pow, x; - GFC_INTEGER_4 n, u; + GFC_INTEGER_4 n; + GFC_UINTEGER_4 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_c4_i4 (GFC_COMPLEX_4 a, GFC_INTEGER_4 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_c4_i8.c b/libgfortran/generated/pow_c4_i8.c index f9fc849..bb113df 100644 --- a/libgfortran/generated/pow_c4_i8.c +++ b/libgfortran/generated/pow_c4_i8.c @@ -45,7 +45,8 @@ GFC_COMPLEX_4 pow_c4_i8 (GFC_COMPLEX_4 a, GFC_INTEGER_8 b) { GFC_COMPLEX_4 pow, x; - GFC_INTEGER_8 n, u; + GFC_INTEGER_8 n; + GFC_UINTEGER_8 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_c4_i8 (GFC_COMPLEX_4 a, GFC_INTEGER_8 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_c8_i16.c b/libgfortran/generated/pow_c8_i16.c index 0fc162b..ee4b68e 100644 --- a/libgfortran/generated/pow_c8_i16.c +++ b/libgfortran/generated/pow_c8_i16.c @@ -45,7 +45,8 @@ GFC_COMPLEX_8 pow_c8_i16 (GFC_COMPLEX_8 a, GFC_INTEGER_16 b) { GFC_COMPLEX_8 pow, x; - GFC_INTEGER_16 n, u; + GFC_INTEGER_16 n; + GFC_UINTEGER_16 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_c8_i16 (GFC_COMPLEX_8 a, GFC_INTEGER_16 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_c8_i4.c b/libgfortran/generated/pow_c8_i4.c index 64b4b3c..30c6007 100644 --- a/libgfortran/generated/pow_c8_i4.c +++ b/libgfortran/generated/pow_c8_i4.c @@ -45,7 +45,8 @@ GFC_COMPLEX_8 pow_c8_i4 (GFC_COMPLEX_8 a, GFC_INTEGER_4 b) { GFC_COMPLEX_8 pow, x; - GFC_INTEGER_4 n, u; + GFC_INTEGER_4 n; + GFC_UINTEGER_4 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_c8_i4 (GFC_COMPLEX_8 a, GFC_INTEGER_4 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_c8_i8.c b/libgfortran/generated/pow_c8_i8.c index 39a5d6b7..d9b658b 100644 --- a/libgfortran/generated/pow_c8_i8.c +++ b/libgfortran/generated/pow_c8_i8.c @@ -45,7 +45,8 @@ GFC_COMPLEX_8 pow_c8_i8 (GFC_COMPLEX_8 a, GFC_INTEGER_8 b) { GFC_COMPLEX_8 pow, x; - GFC_INTEGER_8 n, u; + GFC_INTEGER_8 n; + GFC_UINTEGER_8 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_c8_i8 (GFC_COMPLEX_8 a, GFC_INTEGER_8 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_i16_i16.c b/libgfortran/generated/pow_i16_i16.c index eda2fb6..b665f5e 100644 --- a/libgfortran/generated/pow_i16_i16.c +++ b/libgfortran/generated/pow_i16_i16.c @@ -45,7 +45,8 @@ GFC_INTEGER_16 pow_i16_i16 (GFC_INTEGER_16 a, GFC_INTEGER_16 b) { GFC_INTEGER_16 pow, x; - GFC_INTEGER_16 n, u; + GFC_INTEGER_16 n; + GFC_UINTEGER_16 u; n = b; x = a; @@ -60,7 +61,10 @@ pow_i16_i16 (GFC_INTEGER_16 a, GFC_INTEGER_16 b) return (n & 1) ? -1 : 1; return (x == 0) ? 1 / x : 0; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_i16_i4.c b/libgfortran/generated/pow_i16_i4.c index 6e4d65c..45994a3 100644 --- a/libgfortran/generated/pow_i16_i4.c +++ b/libgfortran/generated/pow_i16_i4.c @@ -45,7 +45,8 @@ GFC_INTEGER_16 pow_i16_i4 (GFC_INTEGER_16 a, GFC_INTEGER_4 b) { GFC_INTEGER_16 pow, x; - GFC_INTEGER_4 n, u; + GFC_INTEGER_4 n; + GFC_UINTEGER_4 u; n = b; x = a; @@ -60,7 +61,10 @@ pow_i16_i4 (GFC_INTEGER_16 a, GFC_INTEGER_4 b) return (n & 1) ? -1 : 1; return (x == 0) ? 1 / x : 0; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_i16_i8.c b/libgfortran/generated/pow_i16_i8.c index d184951..8007505 100644 --- a/libgfortran/generated/pow_i16_i8.c +++ b/libgfortran/generated/pow_i16_i8.c @@ -45,7 +45,8 @@ GFC_INTEGER_16 pow_i16_i8 (GFC_INTEGER_16 a, GFC_INTEGER_8 b) { GFC_INTEGER_16 pow, x; - GFC_INTEGER_8 n, u; + GFC_INTEGER_8 n; + GFC_UINTEGER_8 u; n = b; x = a; @@ -60,7 +61,10 @@ pow_i16_i8 (GFC_INTEGER_16 a, GFC_INTEGER_8 b) return (n & 1) ? -1 : 1; return (x == 0) ? 1 / x : 0; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_i4_i16.c b/libgfortran/generated/pow_i4_i16.c index f515f80..abab476 100644 --- a/libgfortran/generated/pow_i4_i16.c +++ b/libgfortran/generated/pow_i4_i16.c @@ -45,7 +45,8 @@ GFC_INTEGER_4 pow_i4_i16 (GFC_INTEGER_4 a, GFC_INTEGER_16 b) { GFC_INTEGER_4 pow, x; - GFC_INTEGER_16 n, u; + GFC_INTEGER_16 n; + GFC_UINTEGER_16 u; n = b; x = a; @@ -60,7 +61,10 @@ pow_i4_i16 (GFC_INTEGER_4 a, GFC_INTEGER_16 b) return (n & 1) ? -1 : 1; return (x == 0) ? 1 / x : 0; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_i4_i4.c b/libgfortran/generated/pow_i4_i4.c index 184fe6d..e28cf90 100644 --- a/libgfortran/generated/pow_i4_i4.c +++ b/libgfortran/generated/pow_i4_i4.c @@ -45,7 +45,8 @@ GFC_INTEGER_4 pow_i4_i4 (GFC_INTEGER_4 a, GFC_INTEGER_4 b) { GFC_INTEGER_4 pow, x; - GFC_INTEGER_4 n, u; + GFC_INTEGER_4 n; + GFC_UINTEGER_4 u; n = b; x = a; @@ -60,7 +61,10 @@ pow_i4_i4 (GFC_INTEGER_4 a, GFC_INTEGER_4 b) return (n & 1) ? -1 : 1; return (x == 0) ? 1 / x : 0; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_i4_i8.c b/libgfortran/generated/pow_i4_i8.c index ae24ceb5..51d2e14 100644 --- a/libgfortran/generated/pow_i4_i8.c +++ b/libgfortran/generated/pow_i4_i8.c @@ -45,7 +45,8 @@ GFC_INTEGER_4 pow_i4_i8 (GFC_INTEGER_4 a, GFC_INTEGER_8 b) { GFC_INTEGER_4 pow, x; - GFC_INTEGER_8 n, u; + GFC_INTEGER_8 n; + GFC_UINTEGER_8 u; n = b; x = a; @@ -60,7 +61,10 @@ pow_i4_i8 (GFC_INTEGER_4 a, GFC_INTEGER_8 b) return (n & 1) ? -1 : 1; return (x == 0) ? 1 / x : 0; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_i8_i16.c b/libgfortran/generated/pow_i8_i16.c index 456c28a..88713da 100644 --- a/libgfortran/generated/pow_i8_i16.c +++ b/libgfortran/generated/pow_i8_i16.c @@ -45,7 +45,8 @@ GFC_INTEGER_8 pow_i8_i16 (GFC_INTEGER_8 a, GFC_INTEGER_16 b) { GFC_INTEGER_8 pow, x; - GFC_INTEGER_16 n, u; + GFC_INTEGER_16 n; + GFC_UINTEGER_16 u; n = b; x = a; @@ -60,7 +61,10 @@ pow_i8_i16 (GFC_INTEGER_8 a, GFC_INTEGER_16 b) return (n & 1) ? -1 : 1; return (x == 0) ? 1 / x : 0; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_i8_i4.c b/libgfortran/generated/pow_i8_i4.c index 8f85a80..6746af3 100644 --- a/libgfortran/generated/pow_i8_i4.c +++ b/libgfortran/generated/pow_i8_i4.c @@ -45,7 +45,8 @@ GFC_INTEGER_8 pow_i8_i4 (GFC_INTEGER_8 a, GFC_INTEGER_4 b) { GFC_INTEGER_8 pow, x; - GFC_INTEGER_4 n, u; + GFC_INTEGER_4 n; + GFC_UINTEGER_4 u; n = b; x = a; @@ -60,7 +61,10 @@ pow_i8_i4 (GFC_INTEGER_8 a, GFC_INTEGER_4 b) return (n & 1) ? -1 : 1; return (x == 0) ? 1 / x : 0; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_i8_i8.c b/libgfortran/generated/pow_i8_i8.c index 8c8f52e..3050974 100644 --- a/libgfortran/generated/pow_i8_i8.c +++ b/libgfortran/generated/pow_i8_i8.c @@ -45,7 +45,8 @@ GFC_INTEGER_8 pow_i8_i8 (GFC_INTEGER_8 a, GFC_INTEGER_8 b) { GFC_INTEGER_8 pow, x; - GFC_INTEGER_8 n, u; + GFC_INTEGER_8 n; + GFC_UINTEGER_8 u; n = b; x = a; @@ -60,7 +61,10 @@ pow_i8_i8 (GFC_INTEGER_8 a, GFC_INTEGER_8 b) return (n & 1) ? -1 : 1; return (x == 0) ? 1 / x : 0; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_r10_i16.c b/libgfortran/generated/pow_r10_i16.c index ad73664..2377e67 100644 --- a/libgfortran/generated/pow_r10_i16.c +++ b/libgfortran/generated/pow_r10_i16.c @@ -45,7 +45,8 @@ GFC_REAL_10 pow_r10_i16 (GFC_REAL_10 a, GFC_INTEGER_16 b) { GFC_REAL_10 pow, x; - GFC_INTEGER_16 n, u; + GFC_INTEGER_16 n; + GFC_UINTEGER_16 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_r10_i16 (GFC_REAL_10 a, GFC_INTEGER_16 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_r10_i4.c b/libgfortran/generated/pow_r10_i4.c index 3f23732..d21869b 100644 --- a/libgfortran/generated/pow_r10_i4.c +++ b/libgfortran/generated/pow_r10_i4.c @@ -45,7 +45,8 @@ GFC_REAL_10 pow_r10_i4 (GFC_REAL_10 a, GFC_INTEGER_4 b) { GFC_REAL_10 pow, x; - GFC_INTEGER_4 n, u; + GFC_INTEGER_4 n; + GFC_UINTEGER_4 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_r10_i4 (GFC_REAL_10 a, GFC_INTEGER_4 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_r10_i8.c b/libgfortran/generated/pow_r10_i8.c index 2e99c60..5a5ecff 100644 --- a/libgfortran/generated/pow_r10_i8.c +++ b/libgfortran/generated/pow_r10_i8.c @@ -45,7 +45,8 @@ GFC_REAL_10 pow_r10_i8 (GFC_REAL_10 a, GFC_INTEGER_8 b) { GFC_REAL_10 pow, x; - GFC_INTEGER_8 n, u; + GFC_INTEGER_8 n; + GFC_UINTEGER_8 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_r10_i8 (GFC_REAL_10 a, GFC_INTEGER_8 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_r16_i16.c b/libgfortran/generated/pow_r16_i16.c index 63d6fa88..24313c2 100644 --- a/libgfortran/generated/pow_r16_i16.c +++ b/libgfortran/generated/pow_r16_i16.c @@ -45,7 +45,8 @@ GFC_REAL_16 pow_r16_i16 (GFC_REAL_16 a, GFC_INTEGER_16 b) { GFC_REAL_16 pow, x; - GFC_INTEGER_16 n, u; + GFC_INTEGER_16 n; + GFC_UINTEGER_16 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_r16_i16 (GFC_REAL_16 a, GFC_INTEGER_16 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_r16_i4.c b/libgfortran/generated/pow_r16_i4.c index 949f237..3901577 100644 --- a/libgfortran/generated/pow_r16_i4.c +++ b/libgfortran/generated/pow_r16_i4.c @@ -45,7 +45,8 @@ GFC_REAL_16 pow_r16_i4 (GFC_REAL_16 a, GFC_INTEGER_4 b) { GFC_REAL_16 pow, x; - GFC_INTEGER_4 n, u; + GFC_INTEGER_4 n; + GFC_UINTEGER_4 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_r16_i4 (GFC_REAL_16 a, GFC_INTEGER_4 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_r16_i8.c b/libgfortran/generated/pow_r16_i8.c index 37649d8..e723372 100644 --- a/libgfortran/generated/pow_r16_i8.c +++ b/libgfortran/generated/pow_r16_i8.c @@ -45,7 +45,8 @@ GFC_REAL_16 pow_r16_i8 (GFC_REAL_16 a, GFC_INTEGER_8 b) { GFC_REAL_16 pow, x; - GFC_INTEGER_8 n, u; + GFC_INTEGER_8 n; + GFC_UINTEGER_8 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_r16_i8 (GFC_REAL_16 a, GFC_INTEGER_8 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_r4_i16.c b/libgfortran/generated/pow_r4_i16.c index 635e627..e737949 100644 --- a/libgfortran/generated/pow_r4_i16.c +++ b/libgfortran/generated/pow_r4_i16.c @@ -45,7 +45,8 @@ GFC_REAL_4 pow_r4_i16 (GFC_REAL_4 a, GFC_INTEGER_16 b) { GFC_REAL_4 pow, x; - GFC_INTEGER_16 n, u; + GFC_INTEGER_16 n; + GFC_UINTEGER_16 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_r4_i16 (GFC_REAL_4 a, GFC_INTEGER_16 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_r4_i4.c b/libgfortran/generated/pow_r4_i4.c index ff0045f..5baa4b1 100644 --- a/libgfortran/generated/pow_r4_i4.c +++ b/libgfortran/generated/pow_r4_i4.c @@ -45,7 +45,8 @@ GFC_REAL_4 pow_r4_i4 (GFC_REAL_4 a, GFC_INTEGER_4 b) { GFC_REAL_4 pow, x; - GFC_INTEGER_4 n, u; + GFC_INTEGER_4 n; + GFC_UINTEGER_4 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_r4_i4 (GFC_REAL_4 a, GFC_INTEGER_4 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_r4_i8.c b/libgfortran/generated/pow_r4_i8.c index 8c6b2ba..0aae60a 100644 --- a/libgfortran/generated/pow_r4_i8.c +++ b/libgfortran/generated/pow_r4_i8.c @@ -45,7 +45,8 @@ GFC_REAL_4 pow_r4_i8 (GFC_REAL_4 a, GFC_INTEGER_8 b) { GFC_REAL_4 pow, x; - GFC_INTEGER_8 n, u; + GFC_INTEGER_8 n; + GFC_UINTEGER_8 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_r4_i8 (GFC_REAL_4 a, GFC_INTEGER_8 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_r8_i16.c b/libgfortran/generated/pow_r8_i16.c index 9fdcf75..e527f3a 100644 --- a/libgfortran/generated/pow_r8_i16.c +++ b/libgfortran/generated/pow_r8_i16.c @@ -45,7 +45,8 @@ GFC_REAL_8 pow_r8_i16 (GFC_REAL_8 a, GFC_INTEGER_16 b) { GFC_REAL_8 pow, x; - GFC_INTEGER_16 n, u; + GFC_INTEGER_16 n; + GFC_UINTEGER_16 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_r8_i16 (GFC_REAL_8 a, GFC_INTEGER_16 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_r8_i4.c b/libgfortran/generated/pow_r8_i4.c index a6afcbe..8da3b81 100644 --- a/libgfortran/generated/pow_r8_i4.c +++ b/libgfortran/generated/pow_r8_i4.c @@ -45,7 +45,8 @@ GFC_REAL_8 pow_r8_i4 (GFC_REAL_8 a, GFC_INTEGER_4 b) { GFC_REAL_8 pow, x; - GFC_INTEGER_4 n, u; + GFC_INTEGER_4 n; + GFC_UINTEGER_4 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_r8_i4 (GFC_REAL_8 a, GFC_INTEGER_4 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/generated/pow_r8_i8.c b/libgfortran/generated/pow_r8_i8.c index 3b650f2..b858fab 100644 --- a/libgfortran/generated/pow_r8_i8.c +++ b/libgfortran/generated/pow_r8_i8.c @@ -45,7 +45,8 @@ GFC_REAL_8 pow_r8_i8 (GFC_REAL_8 a, GFC_INTEGER_8 b) { GFC_REAL_8 pow, x; - GFC_INTEGER_8 n, u; + GFC_INTEGER_8 n; + GFC_UINTEGER_8 u; n = b; x = a; @@ -55,10 +56,13 @@ pow_r8_i8 (GFC_REAL_8 a, GFC_INTEGER_8 b) if (n < 0) { - n = -n; + u = -n; x = pow / x; } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) diff --git a/libgfortran/m4/pow.m4 b/libgfortran/m4/pow.m4 index ae49004..54e2fda 100644 --- a/libgfortran/m4/pow.m4 +++ b/libgfortran/m4/pow.m4 @@ -46,7 +46,8 @@ rtype_name `pow_'rtype_code`_'atype_code (rtype_name a, atype_name b) { rtype_name pow, x; - atype_name n, u; + atype_name n; + `GFC_UINTEGER_'atype_kind` u;' n = b; x = a; @@ -62,11 +63,14 @@ ifelse(rtype_letter,i,`dnl return (n & 1) ? -1 : 1; return (x == 0) ? 1 / x : 0; ',` - n = -n; + u = -n; x = pow / x; ')dnl } - u = n; + else + { + u = n; + } for (;;) { if (u & 1) |