https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112353
Bug ID: 112353
Summary: asan-enabled, aarch64-gcc cross-compiled elf
executables fail ro run in qemu-user on x86
Product: gcc
Version: 12.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: robert at bedrocksystems dot com
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at
gcc dot gnu.org
Target Milestone: ---
On Ubuntu 23.04 x86_64, an aarch64 cross-compiled elf executable with Address
Sanitizer (asan) enabled, fails with the run-time error:
```
AddressSanitizer: CHECK failed: asan_poisoning.cpp:38 "((AddrIsInMem(addr))) !=
(0)" (0x0, 0x0) (tid=1909)
```
This might be related to qemu and not gcc, but it reproduced also with gcc
13.2.0, but not with gcc 11.4.0.
Versions used:
```
$ aarch64-linux-gnu-g++ --version
aarch64-linux-gnu-g++ (Ubuntu 12.3.0-1ubuntu1~23.04) 12.3.0
$ qemu-aarch64-static -version
qemu-aarch64 version 7.2.0 (Debian 1:7.2+dfsg-5ubuntu2.3)
```
Steps to reproduce:
```
$ echo "int main() {return 1;}" > /tmp/poc.cpp
$ aarch64-linux-gnu-g++ -fsanitize=address /tmp/poc.cpp -o /tmp/poc
$ qemu-aarch64-static /tmp/poc ## this takes a while
AddressSanitizer: CHECK failed: asan_poisoning.cpp:38 "((AddrIsInMem(addr))) !=
(0)" (0x0, 0x0) (tid=2220)
```