NetBSD Problem Report #14531

Received: (qmail 8549 invoked from network); 11 Nov 2001 01:30:46 -0000
Message-Id: <20011111013040.7685E7E27@beowulf.gw.com>
Date: Sat, 10 Nov 2001 20:30:40 -0500 (EST)
From: christos@zoulas.com
Reply-To: christos@zoulas.com
To: gnats-bugs@gnats.netbsd.org
Subject: lint misses conversion warning.
X-Send-Pr-Version: 3.95

>Number:         14531
>Category:       misc
>Synopsis:       lint misses conversion warning.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 11 01:31:00 +0000 2001
>Closed-Date:    Mon Mar 01 22:35:13 +0000 2021
>Last-Modified:  Mon Mar 01 22:35:13 +0000 2021
>Originator:     Christos Zoulas
>Release:        
>Organization:
	Chaos, Inc.
>Environment:
System: NetBSD beowulf.gw.com 1.5X NetBSD 1.5X (GW-GENERIC) #36: Sat Jul 28 11:41:19 EDT 2001 kim@nix.suominen.org:/net/nix/src-3/NetBSD/cvsroot/src/sys/arch/i386/compile/GW-GENERIC i386
Architecture: i386
Machine: i386
>Description:
	Lint does not produce conversion warnings for non integral types.
>How-To-Repeat:
#include <sys/types.h>

void
fug16(u_int16_t a, u_int8_t v) {
	a = v;
	v = a;
}

void
fug32(u_int32_t a, u_int8_t v) {
	a = v;
	v = a;
}

void
main() {
	unsigned long foo = 1;
	fug16(foo, 3);
	fug32(foo, 3);
}

lint -chap fug.c

Notice that there is only one warning produced by the invocation of fug1().

>Fix:
None, sorry.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: rillig@NetBSD.org
State-Changed-When: Mon, 01 Mar 2021 22:35:13 +0000
State-Changed-Why:

Lint does warn about narrowing conversions, just not by default.
It needs to be given the option -aa (yes, -a twice).
See src/tests/usr.bin/xlint/lint1/msg_132.c for a demonstration.
https://mail-index.netbsd.org/source-changes/2021/02/28/msg127390.html
The default LINTFLAGS in share/mk/sys.mk have only -a, not -aa.


>Unformatted:
 	Sat Nov 10 20:29:30 EST 2001

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.