NetBSD Problem Report #39639

From root@azeotrope.org  Sat Sep 27 19:38:58 2008
Return-Path: <root@azeotrope.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 0920A63B884
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 27 Sep 2008 19:38:58 +0000 (UTC)
Message-Id: <20080927193838.EFD471D917C@cheetah.azeotrope.org>
Date: Sat, 27 Sep 2008 14:38:38 -0500 (CDT)
From: khym@azeotrope.org
Reply-To: khym@azeotrope.org
To: gnats-bugs@gnats.NetBSD.org
Subject: lint doesn't handle "long double" properly
X-Send-Pr-Version: 3.95

>Number:         39639
>Category:       bin
>Synopsis:       lint doesn't handle "long double" properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 27 19:40:01 +0000 2008
>Closed-Date:    Sat Sep 27 20:07:46 +0000 2008
>Last-Modified:  Sun Sep 28 07:45:03 +0000 2008
>Originator:     Dave Huang
>Release:        NetBSD 4.99.72
>Organization:

>Environment:


System: NetBSD cheetah.azeotrope.org 4.99.72 NetBSD 4.99.72 (CHEETAH_ACPI) #13: Sat Sep 27 03:39:06 CDT 2008 khym@cheetah.azeotrope.org:/usr/obj.amd64/sys/arch/amd64/compile/CHEETAH_ACPI amd64
Architecture: x86_64
Machine: amd64
>Description:
	It seems like the changes to teach lint about _Complex cause it
to not handle "sizeof(long double)" properly. From what I can tell, the
problem is in lint1/decl.c deftyp(), where a long double gets treated as
long int: t == NOTSPEC, s == NOTSPEC, l == LONG, c == DOUBLE, tp == NULL.
Since t == NOTSPEC, the switch (t) sets t = INT.

A symptom is that building libc (on amd64) fails with:

/usr/src/lib/libc/arch/x86_64/gen/infinityl.c(16): too many array initializers, 
expected 8 [173]

The array is dimensioned as char[sizeof(long double)], which is 16 on amd64,
but lint treats it as char[sizeof(long int)], i.e., 8.

>How-To-Repeat:
	Try to build -current on amd64, or run lint on:

char a[sizeof(long double)] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};

>Fix:


>Release-Note:

>Audit-Trail:
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39639 CVS commit: src/usr.bin/xlint/lint1
Date: Sat, 27 Sep 2008 20:04:24 +0000 (UTC)

 Module Name:	src
 Committed By:	dholland
 Date:		Sat Sep 27 20:04:24 UTC 2008

 Modified Files:
 	src/usr.bin/xlint/lint1: decl.c

 Log Message:
 Don't accidentally treat "long double" as "long". PR bin/39639.


 To generate a diff of this commit:
 cvs rdiff -r1.42 -r1.43 src/usr.bin/xlint/lint1/decl.c

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

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 27 Sep 2008 20:07:46 +0000
State-Changed-Why:
fixed, thanks


From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39639 CVS commit: src/regress/usr.bin/xlint/lint1
Date: Sat, 27 Sep 2008 20:13:03 +0000 (UTC)

 Module Name:	src
 Committed By:	dholland
 Date:		Sat Sep 27 20:13:03 UTC 2008

 Added Files:
 	src/regress/usr.bin/xlint/lint1: test24.c

 Log Message:
 Add test case from PR 39639.


 To generate a diff of this commit:
 cvs rdiff -r0 -r1.1 src/regress/usr.bin/xlint/lint1/test24.c

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

From: David Huang <khym@azeotrope.org>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: PR/39639 CVS commit: src/regress/usr.bin/xlint/lint1
Date: Sat, 27 Sep 2008 16:03:16 -0500

 On Sep 27, 2008, at 3:15 PM, David A. Holland wrote:
 > Added Files:
 > 	src/regress/usr.bin/xlint/lint1: test24.c
 >
 > Log Message:
 > Add test case from PR 39639.


 Hmm, is that really going to work? sizeof(long double) == 16 on amd64,  
 but not everywhere--for example, that test fails on alpha. See the  
 various LDOUBLE_SIZE #defines in xlint/arch/*/targparam.h.

From: David Holland <dholland-bugs@netbsd.org>
To: David Huang <khym@azeotrope.org>
Cc: gnats-bugs@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: PR/39639 CVS commit: src/regress/usr.bin/xlint/lint1
Date: Sun, 28 Sep 2008 07:42:43 +0000

 On Sat, Sep 27, 2008 at 04:03:16PM -0500, David Huang wrote:
 >> Log Message:
 >> Add test case from PR 39639.
 >
 > Hmm, is that really going to work? sizeof(long double) == 16 on amd64, but 
 > not everywhere--for example, that test fails on alpha. See the various 
 > LDOUBLE_SIZE #defines in xlint/arch/*/targparam.h.

 Er, right. stupid of me.

 -- 
 David A. Holland
 dholland@netbsd.org

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39639 CVS commit: src/regress/usr.bin/xlint/lint1
Date: Sun, 28 Sep 2008 07:43:42 +0000 (UTC)

 Module Name:	src
 Committed By:	dholland
 Date:		Sun Sep 28 07:43:42 UTC 2008

 Added Files:
 	src/regress/usr.bin/xlint/lint1: fail-test6.c
 Removed Files:
 	src/regress/usr.bin/xlint/lint1: test24.c

 Log Message:
 Fix test case from PR 39639. This time around, be portable.


 To generate a diff of this commit:
 cvs rdiff -r0 -r1.1 src/regress/usr.bin/xlint/lint1/fail-test6.c
 cvs rdiff -r1.1 -r0 src/regress/usr.bin/xlint/lint1/test24.c

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.