From owner-freebsd-current@FreeBSD.ORG Sun Jul 27 18:35:26 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7AA5E37B401 for ; Sun, 27 Jul 2003 18:35:26 -0700 (PDT) Received: from white.imgsrc.co.jp (ns.imgsrc.co.jp [210.226.20.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3B74343F85 for ; Sun, 27 Jul 2003 18:35:25 -0700 (PDT) (envelope-from kuriyama@imgsrc.co.jp) Received: from localhost (localhost [127.0.0.1]) by white.imgsrc.co.jp (Postfix) with ESMTP id BC359413F for ; Mon, 28 Jul 2003 10:35:23 +0900 (JST) Received: from black.imgsrc.co.jp (black.imgsrc.co.jp [2001:218:422:2::130]) by white.imgsrc.co.jp (Postfix) with ESMTP id 04A4C410C for ; Mon, 28 Jul 2003 10:35:23 +0900 (JST) Received: from black.imgsrc.co.jp (black.imgsrc.co.jp [2001:218:422:2::130]) by black.imgsrc.co.jp (Postfix) with ESMTP id C62B41E460E for ; Mon, 28 Jul 2003 10:35:22 +0900 (JST) Date: Mon, 28 Jul 2003 10:35:22 +0900 Message-ID: <7mvftnv3fp.wl@black.imgsrc.co.jp> From: Jun Kuriyama To: Current In-Reply-To: <7mwue3v6gf.wl@black.imgsrc.co.jp> References: <7mwue3v6gf.wl@black.imgsrc.co.jp> User-Agent: Wanderlust/2.10.0 (Venus) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.4 Emacs/21.2 (i386--freebsd) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS snapshot-20020531 Subject: Re: dereferencing type-punned pointer will break strict-aliasing rules X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2003 01:35:26 -0000 At Mon, 28 Jul 2003 00:30:35 +0000 (UTC), kuriyama wrote: > Is this caused by -oS option? Grrr, of course this should be s/-oS/-Os/. These warnings are caused from DROP_GIANT() macro. By tracking this down, actual source is __PCPU_GET() macro (line: 115) in sys/i386/include/pcpu.h. __result = *(__pcpu_type(name) *)&__i; To test this with simplified code: ----- % cat test.c struct T { int a; }; void test() { struct T* c; int __i = 0; c = *(struct T* *)&__i; } % cc -c -Os -Wall test.c test.c: In function `test': test.c:11: warning: dereferencing type-punned pointer will break strict-aliasing rules ----- __PCPU_GET() macro seems to be harmless if -Os is not used or __pcpu_type() returns actual type rather than pointer. What should we do? -- Jun Kuriyama // IMG SRC, Inc. // FreeBSD Project