From owner-freebsd-current Mon Nov 11 6:16: 6 2002 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 6FCA237B401 for ; Mon, 11 Nov 2002 06:16:04 -0800 (PST) Received: from fgwmail5.fujitsu.co.jp (fgwmail5.fujitsu.co.jp [192.51.44.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id B886343E75 for ; Mon, 11 Nov 2002 06:16:02 -0800 (PST) (envelope-from yoshint@flab.fujitsu.co.jp) Received: from m5.gw.fujitsu.co.jp by fgwmail5.fujitsu.co.jp (8.9.3/3.7W-MX0205-Fujitsu Gateway) id XAA00544 for ; Mon, 11 Nov 2002 23:16:01 +0900 (JST) (envelope-from yoshint@flab.fujitsu.co.jp) Received: from cerberus.proc.flab.fujitsu.co.jp by m5.gw.fujitsu.co.jp (8.12.1/Fujitsu Domain Master) id gABEFxmJ025144 for ; Mon, 11 Nov 2002 23:16:00 +0900 (envelope-from yoshint@flab.fujitsu.co.jp) Received: from cerberus.proc.flab.fujitsu.co.jp (localhost [127.0.0.1]) by cerberus.proc.flab.fujitsu.co.jp (8.12.6/8.12.5) with ESMTP id gABEFx1x019516; Mon, 11 Nov 2002 23:15:59 +0900 (JST) (envelope-from yoshint@flab.fujitsu.co.jp) To: Thomas David Rivers Cc: FreeBSD-current@FreeBSD.ORG, yoshint@flab.fujitsu.co.jp Subject: Re: gcc 3.2.1 optimization bug ? References: <200211111355.gABDt2g55397@lakes.dignus.com> From: TOMITA Yoshinori X-Fortune: =?ISO-2022-JP?B?GyRCOiNGfCROJCQkRjpCJE8hIkw0JGRMXEk4JE4bKEI=?= =?ISO-2022-JP?B?GyRCPEI4PSRLNmEkRSQkJEYkJCRrO34hIxsoQg==?= X-Weather: =?ISO-2022-JP?B?GyRCTEBGfCROP0BGYEBuOCkkT0AyJEckORsoQg==?= X-Face: [|Q@oQ4-)'>a|hK#Wn5u?MMwDs*kTH^u&/.`JOMCIf]22\}]}Fr7`pwbU:1]f>~F(i7vJxW 0JUQD.wjQto]`;7uMKT\?C<,J~3LpT?c|~&l7kMjEvWhoSNj)oWGORj3R"I\/AGXBkCs(w!+Cx)'Ue n&%HI0W0Dc7>4J"% MIME-Version: 1.0 (generated by WEMIKO 1.14.1 - =?ISO-2022-JP?B?Ig==?= =?ISO-2022-JP?B?GyRCNl9KXExTQ24bKEIi?=) Content-Type: text/plain; charset=US-ASCII Date: Mon, 11 Nov 2002 23:15:59 +0900 In-Reply-To: <200211111355.gABDt2g55397@lakes.dignus.com> (Thomas David Rivers's message of "Mon, 11 Nov 2002 08:55:02 -0500 (EST)") Message-ID: User-Agent: T-gnus/6.15.8 (based on Oort Gnus v0.08) (revision 05) Mule-UCS/0.84 (=?ISO-2022-JP?B?S09VR0VUU1VEQUk6GyRCOH43bkJmGyhC?=) WEMIKO/1.14.1 (=?ISO-2022-JP?B?GyRCNl9KXExTQ24bKEI=?=) SLIM/1.14.7 (=?ISO-2022-JP?B?GyRCPHIwZjpMTD4bKEI=?=) APEL/10.3 MULE XEmacs/21.4 (patch 9) (Informed Management) (i386-unknown-freebsd4.6) Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >> On Mon, 11 Nov 2002 08:55:02 -0500 (EST), Thomas David Rivers said: Th> Several people have pointed out that using "volatile" will Th> help with your code. Th> But - even with the use of "volatile" - your code is invalid ANSI Th> C. --snip-- Thanks for your detailed explanation. It cleared me more. Th> Your code appears to simply want to swap the two (assumed) words in Th> an integer. That could be accomplished with shifts, etc... Th> This code makes all kinds of assumptions about the size of Th> `int' and `short' - but represents an alternative approach: Th> unsigned int t; Th> unsigned int x; Th> t = (x & 0xffff) << 16; Th> x >>= 16; Th> x |= t; Th> Assuming `int' was 32-bits wide - this, or something similar, Th> might be a more portable approach. Yes, I agree with your example code. But unfortunately, that ugly code was contained in our inhouse library written by someone. It took me two days to debug and find out where difference comes from between gcc-2.95.4 and gcc-3.2.1. -- TOMITA Yoshinori To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message