NetBSD Problem Report #53298

From k0ga@shike2.com  Thu May 17 20:37:28 2018
Return-Path: <k0ga@shike2.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 705037A19B
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 17 May 2018 20:37:28 +0000 (UTC)
Message-Id: <20180517192127.8A8A16FA176@hal9000.shike2.com>
Date: Thu, 17 May 2018 20:21:27 +0100 (BST)
From: k0ga@shike2.com
Reply-To: k0ga@shike2.com
To: gnats-bugs@NetBSD.org
Subject: long long maximum constants are not exposed in limits.h when a c99 source is compiled
X-Send-Pr-Version: 3.95

>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:          needs-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 17 20:40:00 +0000 2018
>Closed-Date:    
>Last-Modified:  Mon Jan 21 20:34:17 +0000 2019
>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/)

>Release-Note:

>Audit-Trail:

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53298 CVS commit: src/sys/arch/amd64/include
Date: Mon, 21 Jan 2019 20:22:48 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Mon Jan 21 20:22:48 UTC 2019

 Modified Files:
 	src/sys/arch/amd64/include: limits.h

 Log Message:
 Fix wrong scoping of {U,}LLONG_MAX.
 PR 53298 from Roberto E. Vargas Caballero.


 To generate a diff of this commit:
 cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amd64/include/limits.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53298 CVS commit: src/sys/arch
Date: Mon, 21 Jan 2019 20:28:18 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Mon Jan 21 20:28:18 UTC 2019

 Modified Files:
 	src/sys/arch/alpha/include: limits.h
 	src/sys/arch/arm/include: limits.h
 	src/sys/arch/hppa/include: limits.h
 	src/sys/arch/i386/include: limits.h
 	src/sys/arch/ia64/include: limits.h
 	src/sys/arch/m68k/include: limits.h
 	src/sys/arch/mips/include: limits.h
 	src/sys/arch/powerpc/include: limits.h
 	src/sys/arch/sh3/include: limits.h
 	src/sys/arch/sparc/include: limits.h
 	src/sys/arch/vax/include: limits.h

 Log Message:
 Fix wrong scoping of {U,}LLONG_MAX. More cases, not just amd64.
 PR 53298 from Roberto E. Vargas Caballero.


 To generate a diff of this commit:
 cvs rdiff -u -r1.16 -r1.17 src/sys/arch/alpha/include/limits.h
 cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/include/limits.h
 cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hppa/include/limits.h
 cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/include/limits.h
 cvs rdiff -u -r1.8 -r1.9 src/sys/arch/ia64/include/limits.h
 cvs rdiff -u -r1.23 -r1.24 src/sys/arch/m68k/include/limits.h
 cvs rdiff -u -r1.26 -r1.27 src/sys/arch/mips/include/limits.h
 cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/include/limits.h
 cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sh3/include/limits.h
 cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sparc/include/limits.h
 cvs rdiff -u -r1.20 -r1.21 src/sys/arch/vax/include/limits.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53298 CVS commit: src/sys/sys
Date: Mon, 21 Jan 2019 20:29:27 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Mon Jan 21 20:29:27 UTC 2019

 Modified Files:
 	src/sys/sys: common_limits.h

 Log Message:
 Fix wrong scoping of {U,}LLONG_MAX. Final case, I think.
 PR 53298 from Roberto E. Vargas Caballero.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/sys/sys/common_limits.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 21 Jan 2019 20:34:17 +0000
State-Changed-Why:
fixed in HEAD; should probably get into -8, not sure if -7 is worthwhile


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.