The latest coreutils-5.93 evokes a compilation warning on Solaris
7 with gcc 3.3 in lib/xstrtoimax.c:
In file included from xstrtoimax.c:33:
xstrtol.c: In function `bkm_scale':
xstrtol.c:73: warning: integer constant is too large for "long" type
xstrtol.c:75: warning: integer constant is too large for "long" type
xstrtol.c:78: warning: integer constant is too large for "long" type
xstrtol.c:80: warning: integer constant is too large for "long" type
Looking at the pre-processed source, the culprit is that
STRTOL_T_MINIMUM and STRTOL_T_MAXIMUM are 64-bits, but
the LL suffix is missing:
static strtol_error
bkm_scale (intmax_t *x, int scale_factor)
{
if ((! ((intmax_t) 0 < (intmax_t) -1)) && *x < (-9223372036854775807-1) / scal
e_factor)
{
*x = (-9223372036854775807-1);
return LONGINT_OVERFLOW;
}
if ((9223372036854775807) / scale_factor < *x)
{
*x = (9223372036854775807);
return LONGINT_OVERFLOW;
}
*x *= scale_factor;
return LONGINT_OK;
}
This in turn looks to be a bug in Solaris' /usr/include/limits.h that
was since fixed in Solaris 8. It looks like gcc still compiled
everything correctly (tested with "expr 123456789012345 - 1",
which uses xstrtoimax), so I don't know if it is worth trying (or
even possible) to work around the old Solaris bug just to silence
the warning.
--
Eric Blake
_______________________________________________
bug-gnulib mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnulib