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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to