From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7275C3858CD1; Thu, 21 Mar 2024 07:24:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7275C3858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711005869; bh=MatM4MDprZKbMavnliu1OQe+Uw5ynsGPGnirLI3kzEs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jNeZD3XTKJv0bTBW1WCeLHpFtCJqOGqaEu+Af8WEEg7Mwujg/Mb5mX8vz9BjndOay 7ssTxLKtwgzP9K+u2r68d7FE5KTRQu+ayjdq06tEhwLmCka7Si25rwLLgcAimz6Jf6 E39oQ4kMk7ugEElW9pcu5TscIG8L+h4to7pNPy2A= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/111736] Address sanitizer is not compatible with named address spaces Date: Thu, 21 Mar 2024 07:24:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: addr-space, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111736 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |ASSIGNED --- Comment #13 from Richard Biener --- The original testcase is fixed, appearantly slapping 'extern' on the int ma= kes 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;=