From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1rvQ-000288-CF for qemu-devel@nongnu.org; Tue, 01 Jul 2014 02:52:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1rvK-0001j6-7M for qemu-devel@nongnu.org; Tue, 01 Jul 2014 02:52:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31253) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1rvJ-0001ib-V0 for qemu-devel@nongnu.org; Tue, 01 Jul 2014 02:52:14 -0400 Message-ID: <53B25A97.2070407@redhat.com> Date: Tue, 01 Jul 2014 08:52:07 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1404179460-29303-1-git-send-email-aik@ozlabs.ru> <53B24A29.1030607@ozlabs.ru> In-Reply-To: <53B24A29.1030607@ozlabs.ru> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH fix for 2.1] makefile: Fix tools compile List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy , qemu-devel@nongnu.org Cc: Peter Maydell , Alex Graf 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