Re: GSoC2007: cnst-sensors.2007-08-20.patch

From: M. Warner Losh <imp_at_bsdimp.com>
Date: Sun, 26 Aug 2007 00:51:44 -0600 (MDT)
In message: <46D10B10.2060608_at_FreeBSD.org>
            "Constantine A. Murenin" <cnst_at_freebsd.org> writes:
: On 25/08/2007 20:16, Harald Schmalzbauer wrote:
: 
: >>>http://p4web.freebsd.org/_at_sr=125633_at_//depot/projects/soc2007/cnst-sensors/sys.dev.coretemp/coretemp.c
: ...
: > cc -O2 -fno-strict-aliasing -pipe -march=nocona  -D_KERNEL -DKLD_MODULE -std=c99 -nostdinc   -DHAVE_KERNEL_OPTION_HEADERS -include /usr/obj/usr/src/sys/KORSO/opt_global.h -I. -I_at_ -I_at_/contrib/altq -finline-limit=8000 --param 
: > inline-unit-growth=100 --param 
: > large-function-growth=1000 -fno-common -g -fno-omit-frame-pointer -I/usr/obj/usr/src/sys/KORSO -mcmodel=kernel -mno-red-zone  -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx -mno-3dnow  -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions -c /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c
: > /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c: In 
: > function 'coretemp_refresh':
: > /usr/src/sys/modules/coretemp/../../dev/coretemp/coretemp.c:297: error: SSE 
: > register return with SSE disabled
: > *** Error code 1
: > 1 error
: 
: I cannot reproduce this bug on i386 with gcc 4.2.0 20070514, so this 
: sounds like a bug in the compiler, either for allowing me to compile the 
: code that shouldn't compile (and run flawlessly -- coretemp is totally 
: tested here), or for not allowing you to compile the code that should 
: compile. (I'll recompile my compiler tomorrow to catch up on the updates 
: to gcc 4.2.1 to see if that changes anything.)
: 
: Could you please provide more details, e.g. platform (I guess it is 
: amd64?), compiler version and any changes you've made to the tree?
: 
: 
: This is the code that seems to generate this error with your compiler:
: 
: 		s->value = temp * 1e6 + 273.15e6;
: 
: Where s->value is of type int64_t, and temp is of type int.  Does anyone 
: know if the e notation should not be used in this context?

It should not.  1e6 is a floating point number, so the result of this
operation is a floating point number that's then truncated into an
int.  It should be computed as a floating point number.  Chances are
good that the optimizer optimized out all the floating point before,
but doesn't now (or does on i386 and not on amd64).  On amd64, it
appears that this results in attempting to use the SSE stuff, which
results in the compiler error.

Your solution is correct.

Warner
Received on Sun Aug 26 2007 - 04:52:19 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:16 UTC