LONG_MAX is not defined properly in 2.95.2's limits.h
Bwolen Yang
bwolen@verplex.com
Thu Mar 30 00:37:00 GMT 2000
Hi. It appears that LONG_MAX is not defined properly in
./lib/gcc-lib/sparc-sun-solaris2.7/2.95.2/include/limits.h
The definition looks like
/* Minimum and maximum values a `signed long int' can hold.
(Same as `int'). */
#ifndef __LONG_MAX__
#if defined (__alpha__) || defined (__sparc_v9__) || defined (__sparcv9)
#define __LONG_MAX__ 9223372036854775807L
#else
#define __LONG_MAX__ 2147483647L
#endif /* __alpha__ || sparc64 */
Now if we use gcc 2.95.2 on a ultra sparc machine with
-mcpu=ultrasparc
Then, __sparc_v9__ will be defined and thus the above
assumed that we are in 64-bit mode which would be bad if
we are running in 32-bit mode.
NOTE that gcc 2.8.1 appears to have this setup properly.
#ifndef __LONG_MAX__
#if defined (__alpha__) || (defined (__sparc_v9__) && defined (__arch64__))
#define __LONG_MAX__ 9223372036854775807L
#else
#define __LONG_MAX__ 2147483647L
#endif /* __alpha__ || sparc64 */
Note the "&& defined (__arch64__)" conditional to be sure we
don't always use the 64-bit version under ultra-sparc.
--
Bwolen
bwolen@verplex.com
(408)954-9191 x220
Verplex Systems, Inc.
More information about the Gcc-bugs
mailing list