Bug 150170

Summary: [patch] [amd64] [headers] SIG_ATOMIC_MIN/SIG_ATOMIC_MAX 32-bit when sig_atomic_t is 64-bit
Product: Base System Reporter: gerald
Component: amd64Assignee: freebsd-amd64 (Nobody) <amd64>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 8.0-CURRENT   
Hardware: Any   
OS: Any   

Description gerald 2010-09-01 00:00:13 UTC
	On a 9.0-CURRENT machine, amd64, we have:

/usr/include/machine/signal.h:typedef long sig_atomic_t;

	This is 64-bit.  At the same time we have:

/usr/include/machine/_stdint.h:#define	SIG_ATOMIC_MIN	INT32_MIN
/usr/include/machine/_stdint.h:#define	SIG_ATOMIC_MAX	INT32_MAX

	Which is 32-bit.

Fix: 

Initially I thought we may want to adjust SIG_ATOMIC_MIN and
	SIG_ATOMIC_MAX, but really, who need sig_atomic_t to be 64-bit?
	(Linux does not, for what it's worth.)

	In any case, having a type that is larger than the values it can
	take like this is something we should be able to avoid.  At a
	minimum it's inconsistent.
How-To-Repeat: 
	Run GCC's C testsuite and notice a number of C conformance tests
	around stdint fail:

FAIL: gcc.dg/c99-stdint-1.c (test for excess errors)
FAIL: gcc.dg/c99-stdint-2.c (test for excess errors)
FAIL: gcc.dg/c99-stdint-5.c (test for excess errors)
FAIL: gcc.dg/c99-stdint-6.c (test for excess errors)
Comment 1 Andriy Gapon 2010-09-01 11:26:36 UTC
32-bit vs 64-bit seems to be reversed here...

-- 
Andriy Gapon
Comment 2 gerald 2010-09-01 14:32:20 UTC
On Wed, 1 Sep 2010, Andriy Gapon wrote:
> 32-bit vs 64-bit seems to be reversed here...

Yes, you're absolutely right.  I noticed this after submitting the PR and 
fixed it in GNATS, but the mails already had gone out of course.  My bad.

Gerald
Comment 3 Mark Linimon 2010-09-06 08:16:31 UTC
----- Forwarded message from John Baldwin <jhb@freebsd.org> -----

From: John Baldwin <jhb@freebsd.org>
To: freebsd-amd64@freebsd.org, Andriy Gapon <avg@icyb.net.ua>
Cc: bde@freebsd.org
Subject: Re: amd64/150170: SIG_ATOMIC_MIN/SIG_ATOMIC_MAX 32-bit when
	sig_atomic_t is 64-bit

>  32-bit vs 64-bit seems to be reversed here...

Yes, but we should still fix this one way or another.  I was surprised 
recently when I found that sig_atomic_t was long on amd64.  Perhaps Bruce 
(cc'd) knows which way it should be fixed?

-- 
John Baldwin
_______________________________________________
freebsd-amd64@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-amd64
To unsubscribe, send any mail to "freebsd-amd64-unsubscribe@freebsd.org"

----- End forwarded message -----
Comment 4 b. f. 2011-01-29 02:54:28 UTC
This PR:

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=amd64/150170

seems to be a duplicate of:

kern/145590: [kernel] [[patch] SIG_ATOMIC_{MIN,MAX} does not match
sig_atomic_t on 64-bit archs

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=kern/145590

Regards,

b.
Comment 5 Mark Linimon 2011-01-29 03:07:49 UTC
See also kern/145590.
Comment 6 Jaakko Heinonen freebsd_committer freebsd_triage 2011-12-11 09:50:28 UTC
State Changed
From-To: open->closed

Duplicate of kern/145590.