NetBSD Problem Report #51371

From www@NetBSD.org  Thu Jul 28 06:14:50 2016
Return-Path: <www@NetBSD.org>
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 "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 57FE97A221
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 28 Jul 2016 06:14:50 +0000 (UTC)
Message-Id: <20160728061449.26CA27A292@mollari.NetBSD.org>
Date: Thu, 28 Jul 2016 06:14:49 +0000 (UTC)
From: fedora.dm0@gmail.com
Reply-To: fedora.dm0@gmail.com
To: gnats-bugs@NetBSD.org
Subject: GCC warnings breaking rump kernel build
X-Send-Pr-Version: www-1.0

>Number:         51371
>Category:       kern
>Synopsis:       GCC warnings breaking rump kernel build
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 28 06:15:00 +0000 2016
>Closed-Date:    Thu Jul 28 07:55:36 +0000 2016
>Last-Modified:  Thu Jul 28 07:55:36 +0000 2016
>Originator:     David Michael
>Release:        current (2016-07-27)
>Organization:
>Environment:
Fedora 24 x86_64, cross-compiling rumpkernel to GNU Hurd i686
>Description:
There are GCC warnings about bit-shifting negative values and misleading indentation that get turned into errors when building the rump kernel project.  They each have straightforward fixes, and the rump kernel project successfully cross-compiles with the patch applied.

The patch applies against both the rump kernel commit and the current NetBSD CVS.
>How-To-Repeat:
# Fetch rumpkernel projects.
git clone https://github.com/rumpkernel/buildrump.sh
buildrump.sh/buildrump.sh checkout
# Also apply this patch manually if needed: https://github.com/rumpkernel/buildrump.sh/pull/82

# Ensure the branch is up to date.
git -C src checkout buildrump-src
git -C src pull origin buildrump-src
# This is the commit I got: https://github.com/rumpkernel/src-netbsd/commit/974306fcc221f48d4e065360a1ef62939fcef184

# Cross-build with GCC 6.1.0.
CC=i686-pc-gnu-gcc buildrump.sh/buildrump.sh fullbuild
>Fix:
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 4cca7c8..78ba9dc 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -912,9 +912,9 @@ rt_xaddrs(u_char rtmtype, const char *cp, const char *cplim,
 	 */
 	if (rtmtype == RTM_GET) {
 		if (((rtinfo->rti_addrs &
-		    (~((1 << RTAX_IFP) | (1 << RTAX_IFA)))) & (~0 << i)) != 0)
+		    (~((1 << RTAX_IFP) | (1 << RTAX_IFA)))) & (~0U << i)) != 0)
 			return 1;
-	} else if ((rtinfo->rti_addrs & (~0 << i)) != 0)
+	} else if ((rtinfo->rti_addrs & (~0U << i)) != 0)
 		return 1;
 	/* Check for bad data length.  */
 	if (cp != cplim) {
diff --git a/sys/netinet/tcp_vtw.c b/sys/netinet/tcp_vtw.c
index f0a04bf..65487f9 100644
--- a/sys/netinet/tcp_vtw.c
+++ b/sys/netinet/tcp_vtw.c
@@ -1050,7 +1050,7 @@ vtw_next_port_v4(struct tcp_ports_iterator *it)
 			if (!(inuse & (1 << i)))
 				continue;

-			inuse &= ~0 << i;
+			inuse &= ~0U << i;

 			if (i < it->slot_idx)
 				continue;
@@ -1164,7 +1164,7 @@ vtw_next_port_v6(struct tcp_ports_iterator *it)
 			if (!(inuse & (1 << i)))
 				continue;

-			inuse &= ~0 << i;
+			inuse &= ~0U << i;

 			if (i < it->slot_idx)
 				continue;
diff --git a/sys/uvm/uvm_aobj.c b/sys/uvm/uvm_aobj.c
index 46913b8..da57ffe 100644
--- a/sys/uvm/uvm_aobj.c
+++ b/sys/uvm/uvm_aobj.c
@@ -929,7 +929,7 @@ uao_get(struct uvm_object *uobj, voff_t offset, struct vm_page **pps,
 				    (flags & PGO_ALLPAGES) != 0)
 					/* need to do a wait or I/O! */
 					done = false;
-					continue;
+				continue;
 			}

 			/*

>Release-Note:

>Audit-Trail:
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51371 CVS commit: src/sys/uvm
Date: Thu, 28 Jul 2016 07:52:06 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Jul 28 07:52:06 UTC 2016

 Modified Files:
 	src/sys/uvm: uvm_aobj.c

 Log Message:
 PR kern/51371: fix misleading indentation


 To generate a diff of this commit:
 cvs rdiff -u -r1.123 -r1.124 src/sys/uvm/uvm_aobj.c

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

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51371 CVS commit: src/sys
Date: Thu, 28 Jul 2016 07:54:31 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Jul 28 07:54:31 UTC 2016

 Modified Files:
 	src/sys/net: rtsock.c
 	src/sys/netinet: tcp_vtw.c

 Log Message:
 PR kern/51371: avoid shifting negative values


 To generate a diff of this commit:
 cvs rdiff -u -r1.192 -r1.193 src/sys/net/rtsock.c
 cvs rdiff -u -r1.15 -r1.16 src/sys/netinet/tcp_vtw.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: martin@NetBSD.org
State-Changed-When: Thu, 28 Jul 2016 07:55:36 +0000
State-Changed-Why:
Applied, thanks!


>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-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.