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:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 17 20:40:00 +0000 2018
>Closed-Date:    Wed May 17 10:16:40 +0000 2023
>Last-Modified:  Wed May 17 10:16:40 +0000 2023
>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


State-Changed-From-To: needs-pullups->pending-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Fri, 31 Mar 2023 09:48:42 +0000
State-Changed-Why:
pullup-8 #1819 https://releng.netbsd.org/cgi-bin/req-8.cgi?show=1819


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53298 CVS commit: [netbsd-8] src/sys/sys
Date: Sat, 1 Apr 2023 16:43:17 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Apr  1 16:43:17 UTC 2023

 Modified Files:
 	src/sys/sys [netbsd-8]: common_limits.h

 Log Message:
 Pull up following revision(s) (requested by riastradh in ticket #1819):

 	sys/sys/common_limits.h: revision 1.3

 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.2.12.1 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: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 17 May 2023 10:16:40 +0000
State-Changed-Why:
pulled up


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.