aboutsummaryrefslogtreecommitdiff
path: root/gcc/asan.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-03-21 08:30:39 +0100
committerRichard Biener <rguenther@suse.de>2024-03-21 10:48:55 +0100
commit134ef2a8cac1a5cc718739bd7d3b3472947c80d6 (patch)
tree2f9b1148cc4bf9e18a44ce02a3df90a9d576a87e /gcc/asan.cc
parent9d6ff6f1ea2ae7fc32ec9fbd0554fb06238ed045 (diff)
downloadgcc-134ef2a8cac1a5cc718739bd7d3b3472947c80d6.zip
gcc-134ef2a8cac1a5cc718739bd7d3b3472947c80d6.tar.gz
gcc-134ef2a8cac1a5cc718739bd7d3b3472947c80d6.tar.bz2
tree-optimization/111736 - avoid address sanitizing of __seg_gs
The following more thoroughly avoids address sanitizing accesses to non-generic address-spaces. PR tree-optimization/111736 * asan.cc (instrument_derefs): Do not instrument accesses to non-generic address-spaces. * gcc.target/i386/pr111736.c: New testcase.
Diffstat (limited to 'gcc/asan.cc')
-rw-r--r--gcc/asan.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/asan.cc b/gcc/asan.cc
index cfe8310..7f91cc6 100644
--- a/gcc/asan.cc
+++ b/gcc/asan.cc
@@ -2755,6 +2755,10 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t,
if (VAR_P (inner) && DECL_HARD_REGISTER (inner))
return;
+ /* Accesses to non-generic address-spaces should not be instrumented. */
+ if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (TREE_TYPE (inner))))
+ return;
+
poly_int64 decl_size;
if ((VAR_P (inner)
|| (TREE_CODE (inner) == RESULT_DECL