]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
analyzer: regions in different memory spaces can't alias
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 2 Jun 2023 13:28:30 +0000 (09:28 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 2 Jun 2023 13:28:30 +0000 (09:28 -0400)
gcc/analyzer/ChangeLog:
* store.cc (store::eval_alias_1): Regions in different memory
spaces can't alias.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/store.cc

index e8c927b9fe9bc40b7c2c8dad04e0a458df8eaeea..4d1de825e795c060164f2c2843593b51fddc24ff 100644 (file)
@@ -2710,6 +2710,18 @@ tristate
 store::eval_alias_1 (const region *base_reg_a,
                     const region *base_reg_b) const
 {
+  /* If they're in different memory spaces, they can't alias.  */
+  {
+    enum memory_space memspace_a = base_reg_a->get_memory_space ();
+    if (memspace_a != MEMSPACE_UNKNOWN)
+      {
+       enum memory_space memspace_b = base_reg_b->get_memory_space ();
+       if (memspace_b != MEMSPACE_UNKNOWN
+           && memspace_a != memspace_b)
+         return tristate::TS_FALSE;
+      }
+  }
+
   if (const symbolic_region *sym_reg_a
       = base_reg_a->dyn_cast_symbolic_region ())
     {