[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LONG_MAX on Solaris / gcc 2.95.2 (was: [gmp 4] Output line too long.)
From: |
Vincent Lefevre |
Subject: |
LONG_MAX on Solaris / gcc 2.95.2 (was: [gmp 4] Output line too long.) |
Date: |
Tue, 04 Dec 2001 21:42:16 +0100 |
User-agent: |
Pluto/2.03e (RISC-OS/4.02) POPstar/2.03 |
On 04 Dec, Vincent Lefevre <address@hidden> wrote:
> In fact, no. If I compile a simple example with gcc, there is no
> problem. But if I use GMP's Makefile (on the same example), I get
> an integer overflow. So, the problem seems to be in GMP. I'll try
> to see where...
After some tests, the problem is due to the option -mcpu=ultrasparc,
which selects -D__sparc_v9__ for cpp. With the -E option, I get for
ULONG_MAX:
(9223372036854775807L * 2UL + 1)
On the machine, <limits.h> is
/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/include/limits.h
which contains
#ifndef __LONG_MAX__
#if defined (__alpha__) || defined (__sparc_v9__) || defined (__sparcv9)
#define __LONG_MAX__ 9223372036854775807L
#else
#define __LONG_MAX__ 2147483647L
#endif /* __alpha__ || sparc64 */
#endif
__LONG_MAX__ is used to define LONG_MIN, LONG_MAX and ULONG_MAX, but
it is incorrectly set. A fix would be to compile with
-D__LONG_MAX__=2147483647L
I now get (2147483647L * 2UL + 1) for ULONG_MAX, as expected.
--
Vincent Lefèvre <address@hidden> - Web: <http://www.vinc17.org/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des
Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA
Re: [gmp 4] Output line too long., Kevin Ryde, 2001/12/04