[sanitizer_common] Fix signal_line.cpp on SPARC (#100535)
authorRainer Orth <ro@gcc.gnu.org>
Tue, 30 Jul 2024 06:59:12 +0000 (08:59 +0200)
committerTobias Hieta <tobias@hieta.se>
Sun, 4 Aug 2024 09:21:07 +0000 (11:21 +0200)
commit2213bdeb0077d6e89344950568bb321fdef50a86
tree8eb68fdf2b1a2f322f26c171c18503bb1565464d
parent0ee444283e6fc3b40c17a75ba5c073dbceca6f14
[sanitizer_common] Fix signal_line.cpp on SPARC (#100535)

```
  SanitizerCommon-ubsan-sparc-Linux :: Linux/signal_line.cpp
```
currently `FAIL`s on Linux/sparc64 (32 and 64-bit) for `n == 2`. Instead
of the expected `SIGSEGV`, the test dies with `SIGBUS`. `strace` reveals
that this is due to a unaligned access:
```
--- SIGBUS {si_signo=SIGBUS, si_code=BUS_ADRALN, si_addr=0x1} ---
```
which is to be expected on a strict-alignment target like SPARC. Fixed
by changing the invalid pointer to be better aligned.

Tested on `sparc64-unknown-linux-gnu` and `x86_64-pc-linux-gnu`.

(cherry picked from commit 94394ca980f8ecbd845155d2170cfd865e4d62dc)
compiler-rt/test/sanitizer_common/TestCases/Linux/signal_line.cpp