]> git.ipfire.org Git - thirdparty/gcc.git/commit
ubsan: Use right address space for MEM_REF created for bool/enum sanitization [PR115172]
authorJakub Jelinek <jakub@redhat.com>
Wed, 22 May 2024 07:12:28 +0000 (09:12 +0200)
committerJakub Jelinek <jakub@redhat.com>
Wed, 22 May 2024 07:12:28 +0000 (09:12 +0200)
commitd3c506eff54fcbac389a529c2e98da108a410b7f
treebd6c9eabf320895944687f0defa001963259263e
parent73a167cfa225d5ee7092d41596b9fea1719898ff
ubsan: Use right address space for MEM_REF created for bool/enum sanitization [PR115172]

The following testcase is miscompiled, because -fsanitize=bool,enum
creates a MEM_REF without propagating there address space qualifiers,
so what should be normally loaded using say %gs:/%fs: segment prefix
isn't.  Together with asan it then causes that load to be sanitized.

2024-05-22  Jakub Jelinek  <jakub@redhat.com>

PR sanitizer/115172
* ubsan.cc (instrument_bool_enum_load): If rhs is not in generic
address space, use qualified version of utype with the right
address space.  Formatting fix.

* gcc.dg/asan/pr115172.c: New test.
gcc/testsuite/gcc.dg/asan/pr115172.c [new file with mode: 0644]
gcc/ubsan.cc