https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111736
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |ASSIGNED --- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> --- The original testcase is fixed, appearantly slapping 'extern' on the int makes it not effective. Possibly better amend the if (VAR_P (inner) && DECL_HARD_REGISTER (inner)) return; check though. As indicated my fix fixed only VAR_DECL cases, there's still pointer-based accesses (MEM_REF) to consider. So possibly even the following is necessary diff --git a/gcc/asan.cc b/gcc/asan.cc index 0fd7dd1f3ed..36f85757435 100644 --- a/gcc/asan.cc +++ b/gcc/asan.cc @@ -2747,7 +2747,8 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t, || maybe_ne (bitsize, size_in_bytes * BITS_PER_UNIT)) return; - if (VAR_P (inner) && DECL_HARD_REGISTER (inner)) + if ((VAR_P (inner) && DECL_HARD_REGISTER (inner)) + || !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (TREE_TYPE (inner)))) return; poly_int64 decl_size;