2004-08-24 Bud Davis <bdavis9659@comcast.net>
PR fortran/17143
* runtime/error.c (itoa): keep from overflowing during
mod operation by using unsigned variable.
* gfortran.dg/pr17143.f90: New test.
From-SVN: r86532
+2004-08-24 Bud Davis <bdavis9659@comcast.net>
+
+ PR fortran/17143
+ * gfortran.dg/pr17143.f90: New test.
+
2004-08-24 Bud Davis <bdavis9659@comcast.net>
PR fortran/17164
--- /dev/null
+! pr17143
+! does not print 2*63 correctly
+ character*25 l
+ integer*8 i
+ data i /1/
+ do j = 1,63
+ i = i * 2
+ end do
+ write(l,*)i
+ if (l.ne.' -9223372036854775808') then
+! ^
+! the space is required before a number
+ call abort
+ endif
+ end
+
+2004-08-24 Bud Davis <bdavis9659@comcast.net>
+
+ PR fortran/17143
+ * runtime/error.c (itoa): keep from overflowing during
+ mod operation by using unsigned variable.
+
2004-08-24 Bud Davis <bdavis9659@comcast.net>
PR fortran/17164
{
int negative;
char *p;
+ uint64_t t;
if (n == 0)
{
}
negative = 0;
+ t = n;
if (n < 0)
{
negative = 1;
- n = -n;
+ t = -n; /*must use unsigned to protect from overflow*/
}
p = buffer + sizeof (buffer) - 1;
*p-- = '\0';
- while (n != 0)
+ while (t != 0)
{
- *p-- = '0' + (n % 10);
- n /= 10;
+ *p-- = '0' + (t % 10);
+ t /= 10;
}
if (negative)