Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.20.13.1902271852451.30425@monopod.intra.ispras.ru>
Date: Wed, 27 Feb 2019 19:00:38 +0300 (MSK)
From: Alexander Monakov <amonakov@...ras.ru>
To: musl@...ts.openwall.com
Subject: Re: FE Exception triggered by comparison

On Thu, 28 Feb 2019, Damian McGuckin wrote:

> I tried the code below, I was just shocked.
> 
> 	#include	<math.h>
> 	#include	<stdio.h>
> 
> 	main()
> 	{
> 		double x = 5.0;
> 
> 		x -= x, x /= x;
> 		printf("what %s\n", isnan(x) ? "yes" : "no!");
> 		return(0);
> 	}
> 
> Looking at the assembler, there is a subroutine call to __isnan. Awful!

Hm, no, for x86 with GCC you should not see that: the compiler knows how
to expand isnan efficiently.  Are you perhaps on OS X and the 'gcc' command
actually invokes Clang/LLVM?  If not, can you show output of 'gcc -v',
command-line flags you used, and the assembly you're seeing?

Thanks.
Alexander

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.