Date: Thu, 14 Nov 2002 17:37:50 -0800 From: David Schultz <dschultz@uclink.Berkeley.EDU> To: TOMITA Yoshinori <yoshint@flab.fujitsu.co.jp> Cc: Thomas David Rivers <rivers@dignus.com>, FreeBSD-current@FreeBSD.ORG Subject: Re: gcc 3.2.1 optimization bug ? Message-ID: <20021115013750.GA12079@HAL9000.homeunix.com> In-Reply-To: <ywlfzu8i44g.fsf@cerberus.proc.flab.fujitsu.co.jp> References: <ywlvg34jn21.fsf@cerberus.proc.flab.fujitsu.co.jp> <200211111355.gABDt2g55397@lakes.dignus.com> <ywlfzu8i44g.fsf@cerberus.proc.flab.fujitsu.co.jp>
next in thread | previous in thread | raw e-mail | index | archive | help
Thus spake TOMITA Yoshinori <yoshint@flab.fujitsu.co.jp>: > 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. You can work around the problem by disabling -fschedule-insns or -fstrict-aliasing, both of which are turned on by -O2. The latter option is the more direct cause of your problem, but for some reason only the combination of the two seems to generate incorrect output on i386. Of course what you really ought to do is fix the code. C99 makes no provisions for type punning, to my knowledge. However, the GCC project officially blesses two practices: - referring to any object through a character pointer - punning the elements of a union Note that the latter only works if you directly refer to the union directly, rather than through a pointer. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021115013750.GA12079>