This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
LONG_MAX is not defined properly in 2.95.2's limits.h
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: LONG_MAX is not defined properly in 2.95.2's limits.h
- From: Bwolen Yang <bwolen at verplex dot com>
- Date: Thu, 30 Mar 2000 00:30:10 -0800 (PST)
- cc: lcliu at verplex dot com
- Reply-To: bwolen at verplex dot com
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.