tests/docker: only enable ubsan for test-clang
PATCH 1/1 tests/docker: only enable ubsan for test-clang
-fsanitize=undefined is not the same thing as --enable-sanitizers. After commit 47c823e ("tests/docker: add sanitizers back to clang build", 2019-09-11) test-clang is almost duplicating the asan (test-debug) test, so partly revert commit 47c823e5b while leaving ubsan enabled.
--- tests/docker/test-clang | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tests/docker/test-clang +3 -1
@@ -17,7 +17,9 @@ requires clang cd "$BUILD_DIR" -OPTS="--cxx=clang++ --cc=clang --host-cc=clang --enable-sanitizers" +OPTS="--cxx=clang++ --cc=clang --host-cc=clang" +OPTS="$OPTS --extra-cflags=-fsanitize=undefined \ + --extra-cflags=-fno-sanitize=float-divide-by-zero" build_qemu $OPTS check_qemu install_qemu
Signature · 1 line
1.8.3.1
Quoted 6 lines · Paolo Bonzini
-fsanitize=undefined is not the same thing as --enable-sanitizers. After commit 47c823e ("tests/docker: add sanitizers back to clang build", 2019-09-11) test-clang is almost duplicating the asan (test-debug) test, so partly revert commit
47c823e5bwhile leaving ubsan enabled.Signed-off-by Paolo Bonzini <[email protected]>
I got confused by this:
```
if compile_prog "$CPU_CFLAGS -Werror -fsanitize=undefined" ""; then
have_ubsan=yes
fi
```it looked quite like --enable-sanitizers was indeed the same as -fsanitize=undefined; or at least was a superset of such.
I suppose the argument you're making here is that we *only* want ubsan for test-clang?
(I guess so, since test-debug also stipulates that clang be used; but enables debug.)
In this case, is there a use for test-clang at all, actually?
--js
Quoted 20 lines
--- tests/docker/test-clang | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tests/docker/test-clang +3
-1@@ -17,7 +17,9 @@ requires clang cd "$BUILD_DIR" -OPTS="--cxx=clang++ --cc=clang --host-cc=clang --enable-sanitizers" +OPTS="--cxx=clang++ --cc=clang --host-cc=clang" +OPTS="$OPTS --extra-cflags=-fsanitize=undefined \ + --extra-cflags=-fno-sanitize=float-divide-by-zero" build_qemu $OPTS check_qemu install_qemu
Signature · 1 line
—js
Quoted 11 lines · John Snow
it looked quite like --enable-sanitizers was indeed the same as -fsanitize=undefined; or at least was a superset of such.
I suppose the argument you're making here is that we *only* want ubsan for test-clang?
(I guess so, since test-debug also stipulates that clang be used; but enables debug.)
In this case, is there a use for test-clang at all, actually?
Yes, test-clang checks that clang-specific warnings do not fire. Enabling ubsan isn't particularly useful in this respect, but it's okay for me to keep it.
Paolo
Quoted 11 lines · Paolo Bonzini
Quoted 10 lines · John Snow
it looked quite like --enable-sanitizers was indeed the same as -fsanitize=undefined; or at least was a superset of such.
I suppose the argument you're making here is that we *only* want ubsan for test-clang?
(I guess so, since test-debug also stipulates that clang be used; but enables debug.)
Quoted 8 lines
Quoted 1 line
In this case, is there a use for test-clang at all, actually?
Yes, test-clang checks that clang-specific warnings do not fire. Enabling ubsan isn't particularly useful in this respect, but it's okay for me to keep it.
Paolo
If it's a proper subset of test-debug, let's just drop it entirely and leave it to be a "normal" clang invocation.
(Oh, it was already pulled. well, whatever.)
--js