All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] iotest 013 failure under clang -fsanitize=undefined
@ 2016-02-02 20:03 John Snow
  2016-02-02 21:47 ` Laszlo Ersek
  2016-02-02 21:59 ` Eric Blake
  0 siblings, 2 replies; 8+ messages in thread
From: John Snow @ 2016-02-02 20:03 UTC (permalink / raw)
  To: Qemu-block
  Cc: Kevin Wolf, Paolo Bonzini, Laszlo Ersek, qemu-devel, Peter Maydell

Recently, qemu iotest 013 has started to fail for me:

Fedora release 22 (Twenty Two)

3.5.0-9.fc22
clang version 3.5.0 (tags/RELEASE_350/final)
Target: x86_64-redhat-linux-gnu
Thread model: posix


+4 KiB/home/jsnow/src/qemu/qemu-io-cmds.c:230:18: runtime error:
division by zero


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.

Two workarounds:

(1) Modify the tdiv() function to just return INFINITY manually if the
timestamp provided is 0

(2) Modify tester scripts to also use -fno-sanitize=float-divide-by-zero


I prepared a patch to do the first workaround [1] so I could test
patches with clang in peace as I need to test my pull requests under
clang to make sure I don't break OSX, but it seems so absurd to have to
do this, so I have copied our resident language lawyers (and language
pragmatists) so that they can have a say.

Relevant upstream BZ: https://llvm.org/bugs/show_bug.cgi?id=17000

--js

[1]
https://github.com/jnsnow/qemu/commit/af93977dd2bc7ea936b8064c41c5a0f9d25ae2d1

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-02-03  7:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-02 20:03 [Qemu-devel] iotest 013 failure under clang -fsanitize=undefined John Snow
2016-02-02 21:47 ` Laszlo Ersek
2016-02-02 22:00   ` John Snow
2016-02-02 22:13     ` Laszlo Ersek
2016-02-03  7:19   ` Markus Armbruster
2016-02-02 21:59 ` Eric Blake
2016-02-02 22:16   ` Paolo Bonzini
2016-02-03  7:21     ` Markus Armbruster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.