[Bug target/91441] ICE in asan_shadow_offset at asan.c:342 on riscv64 target

2019-08-18 Thread kito at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91441

kito at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||kito at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #3 from kito at gcc dot gnu.org ---
Fixed

[Bug target/91441] ICE in asan_shadow_offset at asan.c:342 on riscv64 target

2019-08-18 Thread kito at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91441

--- Comment #2 from kito at gcc dot gnu.org ---
Author: kito
Date: Mon Aug 19 03:21:44 2019
New Revision: 274631

URL: https://gcc.gnu.org/viewcvs?rev=274631=gcc=rev
Log:
PR target/91441 - Turn off -fsanitize=kernel-address if
TARGET_ASAN_SHADOW_OFFSET is not implemented.

 - -fsanitize=kernel-address will call targetm.asan_shadow_offset ()
   at asan_shadow_offset, so it will crash if TARGET_ASAN_SHADOW_OFFSET
   is not implemented, that's mean -fsanitize=kernel-address is not
   supported for target without TARGET_ASAN_SHADOW_OFFSET implementation.

gcc/ChangeLog:

PR target/91441
* toplev.c (process_options): Check TARGET_ASAN_SHADOW_OFFSET is
implemented for -fsanitize=kernel-address, and merge check logic
with -fsanitize=address.

testsuite/ChangeLog:

PR target/91441
* gcc.target/riscv/pr91441.c: New.

Added:
trunk/gcc/testsuite/gcc.target/riscv/pr91441.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/toplev.c

[Bug target/91441] ICE in asan_shadow_offset at asan.c:342 on riscv64 target

2019-08-14 Thread kito.cheng at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91441

--- Comment #1 from Kito Cheng  ---
Confirmed, a hot fix here, will send to gcc-patch after test.

diff --git a/gcc/toplev.c b/gcc/toplev.c
index 7e0b9216dea..5dd5b66b89c 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1744,20 +1744,12 @@ process_options (void)
   /* Address Sanitizer needs porting to each target architecture.  */

   if ((flag_sanitize & SANITIZE_ADDRESS)
-  && !FRAME_GROWS_DOWNWARD)
+  && (!FRAME_GROWS_DOWNWARD || targetm.asan_shadow_offset == NULL))
 {
   warning_at (UNKNOWN_LOCATION, 0,
  "%<-fsanitize=address%> and %<-fsanitize=kernel-address%> "
  "are not supported for this target");
-  flag_sanitize &= ~SANITIZE_ADDRESS;
-}
-
-  if ((flag_sanitize & SANITIZE_USER_ADDRESS)
-  && targetm.asan_shadow_offset == NULL)
-{
-  warning_at (UNKNOWN_LOCATION, 0,
- "%<-fsanitize=address%> not supported for this target");
-  flag_sanitize &= ~SANITIZE_ADDRESS;
+  flag_sanitize &= ~(SANITIZE_ADDRESS | SANITIZE_USER_ADDRESS);
 }

  /* Do not use IPA optimizations for register allocation if profiler is active

[Bug target/91441] ICE in asan_shadow_offset at asan.c:342 on riscv64 target

2019-08-14 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91441

Martin Liška  changed:

   What|Removed |Added

   Last reconfirmed||2019-8-14
 CC||kito.cheng at gmail dot com,
   ||wilson at gcc dot gnu.org
   Target Milestone|--- |10.0