[PATCH] D85433: [compiler-rt][ubsan][test] XFAIL TypeCheck/misaligned.cpp on Sparc
Rainer Orth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 9 03:00:42 PDT 2020
ro added inline comments.
================
Comment at: compiler-rt/test/ubsan/TestCases/TypeCheck/misaligned.cpp:12
+// RUN: %clangxx %gmlt -fsanitize=alignment -fsanitize-trap %s -O3 -o %t
+// RUN: not --crash %run %t s1
+
----------------
ro wrote:
> vsk wrote:
> > ro wrote:
> > > vsk wrote:
> > > > Is it possible to write this as `not --crash %run %t s1 2>&1 | FileCheck %s --check-prefix=CHECK-STORE`? I'd expect the ubsan runtime to be able to print out the diagnostic, then call abort().
> > > Unfortunately not: with `-fsanitize-trap` the runtime isn't entered at all. Everywhere I tried (Linux/x86_84, Solaris/sparcv9, Linux/sparc64) the test program just prints
> > > ```
> > > Illegal Instruction (core dumped)
> > > ```
> > > IIUC this is just the use case for `-fsanitize-trap`: environments where the runtime isn't available (kernel) or cannot be used (libc).
> > I apologize - I mixed up -fsanitize-trap and -fno-sanitize-recover=alignment. According to https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#usage, it should be possible to use the latter to enter the runtime and then abort.
> You're right: quick manual testing suggests that this works fine.
> I'll post the updated patch after proper testing later.
>
> Thanks a lot: this is way better than just `XFAIL`ing the test.
Full testing on `sparcv9-sun-solaris2.11`, `amd64-pc-linux-gnu`, and `x86_64-pc-linux-gnu` confirmed that this works just fine.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85433/new/
https://reviews.llvm.org/D85433
More information about the llvm-commits
mailing list