NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/53298: long long maximum constants are not exposed in limits.h when a c99 source is compiled



	Note: There was a bad value `' for the field `Class'.
	It was set to the default value of `sw-bug'.

>Number:         53298
>Category:       lib
>Synopsis:       long long maximum constants are not exposed in limits.h when a c99 source is compiled
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 17 20:40:00 +0000 2018
>Originator:     Roberto E. Vargas Caballero
>Release:        NetBSD 7.1.2
>Organization:
>Environment:
System: NetBSD hal9000 7.1.2 NetBSD 7.1.2 (GENERIC) #1: Tue Apr 17 22:38:39 BST 2018 k0ga@hal9000:/usr/objdir/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	LLONG_MAX is not defined in C99 (and not POSIX) compilations
>How-To-Repeat:
$ cat <<EOF > f.c
#include <limits.h>

long long
f(void)
{
	return LLONG_MAX;
}
EOF
$ c99 -D_ISOC99_SOURCE -D_ANSI_SOURCE f.c
>Fix:

Move

	#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
	    defined(_NETBSD_SOURCE)
	#define ULLONG_MAX      0xffffffffffffffffULL   /* max unsigned long long */
	#define LLONG_MAX       0x7fffffffffffffffLL    /* max signed long long */
	#define LLONG_MIN       (-0x7fffffffffffffffLL-1) /* min signed long long */
	#endif

out of

	#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
	    defined(_NETBSD_SOURCE)

in /usr/include/amd64/limits.h (I have seen the same problem in /usr/include/i386/amd64/)



Home | Main Index | Thread Index | Old Index