|
From: | Paolo Bonzini |
Subject: | Re: [Qemu-devel] [PATCH fix for 2.1] makefile: Fix tools compile |
Date: | Tue, 01 Jul 2014 08:52:07 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
Il 01/07/2014 07:42, Alexey Kardashevskiy ha scritto:
This is wrong actually. The problem here that compiler knows how to optimize constants. sin(0.0) is the one while log(0.0) is not (it is supposed to throw error or something as it the result is infinity). So the correct test here could be: int main(void) { volatile double x = 1; return isnan(sin(x)); } But I am afraid pretty soon compilers will learn how to optimize this as well :)
I think something like "double x; int f(void) {return isnan(sin(x));}" should be bullet proof.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |