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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122522
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-03-04 Thomas Koenig <Thomas.Koenig@online.de>
+
+ PR libfortran/30981
+ * gfortran.dg/integer_exponentiation_1.f90: New test.
+
2007-03-04 Nathan Sidwell <nathan@codesourcery.com>
* gcc.target/m68k/m68k.exp: New.
--- /dev/null
+! { dg-do run }
+! PR 30981 - this used to go into an endless loop during execution.
+program test
+ a = 3.0
+ b = a**(-2147483647-1) ! { dg-warning "Integer outside symmetric range" }
+end program test
+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
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
return (n & 1) ? -1 : 1;
return (x == 0) ? 1 / x : 0;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
return (n & 1) ? -1 : 1;
return (x == 0) ? 1 / x : 0;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
return (n & 1) ? -1 : 1;
return (x == 0) ? 1 / x : 0;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
return (n & 1) ? -1 : 1;
return (x == 0) ? 1 / x : 0;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
return (n & 1) ? -1 : 1;
return (x == 0) ? 1 / x : 0;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
return (n & 1) ? -1 : 1;
return (x == 0) ? 1 / x : 0;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
return (n & 1) ? -1 : 1;
return (x == 0) ? 1 / x : 0;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
return (n & 1) ? -1 : 1;
return (x == 0) ? 1 / x : 0;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
return (n & 1) ? -1 : 1;
return (x == 0) ? 1 / x : 0;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
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;
if (n < 0)
{
- n = -n;
+ u = -n;
x = pow / x;
}
- u = n;
+ else
+ {
+ u = n;
+ }
for (;;)
{
if (u & 1)
`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;
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)