LONG_MAX defined as 64bit on ILP32 compile when -mcpu=v9

kabe@sra-tohoku.co.jp kabe@sra-tohoku.co.jp
Thu Dec 9 20:45:00 GMT 1999


/*
 * Bug Description:
 *	LONG_MAX macro defined as 64bit (9223372036854775807L)
 *	even if the compile is for 32bit "long"
 *	(bug in glimits.h ?)
 *
 * gcc version:
 *	gcc version 2.95.2 19991024 (release)
 *
 * Build flags:
 *	./configure --prefix=/usr/local/gnu
 *
 * Platform:
 *	OS:		SunOS 5.7 (japanese edition)
 *	Machine:	Sun Ultra-60
 *
 * Reproducing input:
 *	gcc -E -mcpu=v9 thisfile.c | grep printf
 *
 * Expected output:
 *	printf("2147483647L"   "\n");
 *
 * Observed output:
 *	printf("9223372036854775807L"   "\n");
 *
 * The full preprocessor output (gzip + uuencode): attached at bottom
 *
 * Cause:
 *	the fixinclude'd <limits.h> contains:
 *
 *	#if defined (__alpha__) || defined (__sparc_v9__) || defined (__sparcv9)
 *	#define __LONG_MAX__ 9223372036854775807L
 *
 *	which defines __LONG_MAX__ for 64bit even if "long" was 32bit.
 *	The previous version of limits.h (from egcs-2.91.57 19980901) said:
 *
 *	#if defined (__alpha__) || (defined (__sparc_v9__) && defined (__arch64__))
 *	which (fortunately?) did not cause the problem.
 *
 */
#include <limits.h>

#define s1(s) # s
#define s2(s) s1(s)
main()
{
	printf(s2(LONG_MAX) "\n");
}

/*
 * The full preprocessor output (gzip + uuencode):
 * :r !gcc -E -mcpu=v9 thisfile.c | gzip -9 |uuencode thisfile.i.gz
 *
begin 644 thisfile.i.gz
M'XL( #2 4#@" [56P6ZC,! ]FZ\8P24Y!&,;"BB77BMM3[U60BPQJ;7$B;"1
MMEKMO]= L@V)V<)NX@,(>_S>S/C-& \(N/I-J%)4W"]<!YP9PVMWXT;5N-H7
M>86WLL&5^(ZW1;%JW^J0U\5*-7*E]E5>"T7]&%,_C7R*A2RJ9L.-_4YHY;^Y
M!HMU]$<7X";PZEU=,]S3=0-,PAM"LZ&WX]PM._2/_M,[U/EVEX/8<*F1^[CP
MEJ==B/AA@M($!X8Y@)?G)Q?96$SV<,ESW=0\TUS9"$>Y+O892A*C-,:$XB#L
M*,<8A<JS#2\OC\S*\FG;$D0= <&4'@EFR?F. _Y4#"5?A<S.["_?CBVD"R.X
MMH2>FP7I#.[S,H^F"(/V8KV"@-EIFKX(_X)TBBH9+:IC*&#K=8/<29U9^XM=
MK&?61JY15X$$!P\SU0K_K4.+/";U>T:^2ME4/-0.F!D43%J%2>1@=ZF=1\AN
M,"U/^OW 33U!M9=;5)@[X$>FUV:>_]2\EMTT9$8\Q5Z6"R.)Y1K]K63#T8RS
M,VV2^(9WSNDH/8AO>P'WP*V[=_"V3]GG8] /KSH2V-8LID,LN\H\"*/!;Q30
M;GZ7"[E8.K\<=*C-09<+-Z64L9@&["&)PCB.DB#^Y@* ^RK=Y=KY[3@?$,<\
%2Y()  !8
 
end
 *
 */


More information about the Gcc-bugs mailing list