From owner-freebsd-bugs@FreeBSD.ORG Mon Feb 9 20:50:21 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2C4B716A4CE for ; Mon, 9 Feb 2004 20:50:21 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 129D143D1F for ; Mon, 9 Feb 2004 20:50:21 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i1A4oKbv071847 for ; Mon, 9 Feb 2004 20:50:20 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i1A4oK69071846; Mon, 9 Feb 2004 20:50:20 -0800 (PST) (envelope-from gnats) Resent-Date: Mon, 9 Feb 2004 20:50:20 -0800 (PST) Resent-Message-Id: <200402100450.i1A4oK69071846@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Roop Nanuwa Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BDB1916A4CE for ; Mon, 9 Feb 2004 20:40:10 -0800 (PST) Received: from h24-82-165-92.va.shawcable.net (h24-82-165-92.va.shawcable.net [24.82.165.92]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5D8C43D1F for ; Mon, 9 Feb 2004 20:40:09 -0800 (PST) (envelope-from roop@h24-82-165-92.va.shawcable.net) Received: from h24-82-165-92.va.shawcable.net (localhost [127.0.0.1]) i1A4eGcX088007 for ; Mon, 9 Feb 2004 20:40:16 -0800 (PST) (envelope-from roop@h24-82-165-92.va.shawcable.net) Received: (from root@localhost)i1A4eF0I088006; Mon, 9 Feb 2004 20:40:15 -0800 (PST) (envelope-from roop) Message-Id: <200402100440.i1A4eF0I088006@h24-82-165-92.va.shawcable.net> Date: Mon, 9 Feb 2004 20:40:15 -0800 (PST) From: Roop Nanuwa To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/62615: [PATCH] fix ypxfr/ypxfr_misc.c strict aliasing error X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Roop Nanuwa List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Feb 2004 04:50:21 -0000 >Number: 62615 >Category: bin >Synopsis: [PATCH] fix ypxfr/ypxfr_misc.c strict aliasing error >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Feb 09 20:50:20 PST 2004 >Closed-Date: >Last-Modified: >Originator: Roop Nanuwa >Release: FreeBSD 5.2-CURRENT i386 >Organization: >Environment: System: FreeBSD h24-82-165-92.va.shawcable.net 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Sat Feb 7 15:13:01 PST 2004 roop@h24-82-165-92.va.shawcable.net:/usr/obj/usr/src/sys/TURING i386 >Description: ypxfr_misc.c contains an error that violates strict aliasing rules. When compiling with -O2 optimizations (or just -fstrict-aliasing) the code refuses to compile. The variable 'order' was created as an unsigned long and then passed by reference as type int* which caused the compilation error. The variable is only used to return the order value as an unsigned long. The fix changes the type of 'order' to 'unsigned int' and then passes that to the yp_order function without breaking aliasing rules. The only need for it to actually be an unsigned long is for the return type which it is safely up-cast as. >How-To-Repeat: Attempt to buildworld with -O2 or -fstrict-aliasing. Among many other locations one of the errors will be in usr.sbin/rpc.ypxfr which is caused by the above problem. >Fix: --- libexec/ypxfr/ypxfr_misc.c.old Sat May 3 17:59:13 2003 +++ libexec/ypxfr/ypxfr_misc.c Mon Feb 9 20:17:07 2004 @@ -194,9 +194,9 @@ ypxfr_get_order(char *domain, char *map, char *source, const int yplib) { if (yplib) { - unsigned long order; + unsigned int order; int res; - if ((res = yp_order(domain, map, (int *)&order))) { + if ((res = yp_order(domain, map, &order))) { switch (res) { case YPERR_DOMAIN: yp_errno = YPXFR_NODOM; >Release-Note: >Audit-Trail: >Unformatted: