diff --git a/gcc/testsuite/gcc.target/riscv/pr91441.c b/gcc/testsuite/gcc.dg/pr91441.c
similarity index 85%
rename from gcc/testsuite/gcc.target/riscv/pr91441.c
rename to gcc/testsuite/gcc.dg/pr91441.c
index b55df5e7f00c36cf9fb9eca18b901516d3d51715..4f7a8fbec5e92e204512153720d294f2d8919a65 100644
--- a/gcc/testsuite/gcc.target/riscv/pr91441.c
+++ b/gcc/testsuite/gcc.dg/pr91441.c
@@ -1,5 +1,6 @@
 /* PR target/91441 */
 /* { dg-do compile  } */
+/* { dg-require-effective-target no_fsanitize_address }*/
 /* { dg-options "--param asan-stack=1 -fsanitize=kernel-address" } */
 
 int *bar(int *);
diff --git a/gcc/testsuite/gcc.target/riscv/pr96260.c b/gcc/testsuite/gcc.dg/pr96260.c
similarity index 77%
rename from gcc/testsuite/gcc.target/riscv/pr96260.c
rename to gcc/testsuite/gcc.dg/pr96260.c
index 229997f877b76f404b3fb838f2c3c01da3393db0..734832f021e321f58b8a73d09539114bef33ee0f 100644
--- a/gcc/testsuite/gcc.target/riscv/pr96260.c
+++ b/gcc/testsuite/gcc.dg/pr96260.c
@@ -1,5 +1,6 @@
 /* PR target/96260 */
 /* { dg-do compile } */
+/* { dg-require-effective-target no_fsanitize_address }*/
 /* { dg-options "--param asan-stack=1 -fsanitize=kernel-address -fasan-shadow-offset=0x100000" } */
 
 int *bar(int *);
diff --git a/gcc/testsuite/gcc.dg/pr96307.c b/gcc/testsuite/gcc.dg/pr96307.c
new file mode 100644
index 0000000000000000000000000000000000000000..cd1c17c9661b190a464f0eb0069a80d5625451dd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr96307.c
@@ -0,0 +1,25 @@
+/* PR target/96307 */
+/* { dg-do compile } */
+/* { dg-require-effective-target no_fsanitize_address }*/
+/* { dg-additional-options "-fsanitize=kernel-address --param=asan-instrumentation-with-call-threshold=8" } */
+
+#include <limits.h>
+enum a {test1, test2, test3=INT_MAX};
+enum a a;
+enum a *b;
+
+void reset (void);
+
+void
+t()
+{
+  if (a != test2)
+    __builtin_abort ();
+  if (*b != test2)
+    __builtin_abort ();
+  reset ();
+  if (a != test1)
+    __builtin_abort ();
+  if (*b != test1)
+    __builtin_abort ();
+}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 8439720baea2fe61f1113f963493af9fb3f45679..08e96e12ee8fcb1853326f568aed8f20ab03ff86 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -10582,3 +10582,14 @@ proc check_effective_target_movdir { } {
 	}
     } "-mmovdiri -mmovdir64b" ]
 }
+
+# Return 1 if target is not support address sanitize, 1 otherwise.
+
+proc check_effective_target_no_fsanitize_address {} {
+    if ![check_no_compiler_messages fsanitize_address executable {
+	int main (void) { return 0; }
+    }] {
+	return 1;
+    }
+    return 0;
+}
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 20e231f4d2a47f142142832407541b9e70f13e81..e32dc285c1c95385ab6e841b9d54c0a8808b880c 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1843,7 +1843,6 @@ process_options (void)
 
   if ((flag_sanitize & SANITIZE_KERNEL_ADDRESS)
       && (targetm.asan_shadow_offset == NULL
-	  && param_asan_stack
 	  && !asan_shadow_offset_set_p ()))
     {
       warning_at (UNKNOWN_LOCATION, 0,