[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] iotest 013 failure under clang -fsanitize=
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] iotest 013 failure under clang -fsanitize=undefined |
Date: |
Tue, 2 Feb 2016 14:59:18 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
On 02/02/2016 01:03 PM, John Snow wrote:
> The problem is that in the print report for read_f, t2 and t1 can
> actually be the same exact timestamp, and tdiv will try to divide by 0.0.
>
> Normally this is not a problem as this is defined to be INFINITY in C99
> Annex F.
>
> Clang, however, has once again decided to take the pedantic road and
> state that Annex F is optional, and therefore division by 0.0 is
> actually undefined when using -fsanitize=undefined.
>
> Groan.
No kidding. :(
A compiler ceases to be useful when it spews out noise "just because it
can".
>
> Two workarounds:
>
> (1) Modify the tdiv() function to just return INFINITY manually if the
> timestamp provided is 0
Seems reasonable to me.
> https://github.com/jnsnow/qemu/commit/af93977dd2bc7ea936b8064c41c5a0f9d25ae2d1
I'd be okay with this patch, if you want to make it a formal submission,
and if no one else chimes in with any opinion other than disgust at
clang's shenanigans.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature