[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
Fri Aug 7 12:06:39 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
+
----------------
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.


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