public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/PR101331-sanitize-coverage-ice)] c++: fix -fsanitize-coverage=trace-pc ICE [PR101331]
@ 2021-08-12 15:50 Martin Liska
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2021-08-12 15:50 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fff36153aeaa8188bcc29958b2a3e7af9d008017

commit fff36153aeaa8188bcc29958b2a3e7af9d008017
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Aug 12 17:49:14 2021 +0200

    c++: fix -fsanitize-coverage=trace-pc ICE [PR101331]
    
            PR c++/101331
    
    gcc/ChangeLog:
    
            * asan.h (sanitize_coverage_p): Handle when fn == NULL.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/pr101331.C: New test.

Diff:
---
 gcc/asan.h                      | 5 +++--
 gcc/testsuite/g++.dg/pr101331.C | 7 +++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gcc/asan.h b/gcc/asan.h
index 8c0b2baf170..820c18bbd0a 100644
--- a/gcc/asan.h
+++ b/gcc/asan.h
@@ -255,8 +255,9 @@ static inline bool
 sanitize_coverage_p (const_tree fn = current_function_decl)
 {
   return (flag_sanitize_coverage
-	  && lookup_attribute ("no_sanitize_coverage",
-			       DECL_ATTRIBUTES (fn)) == NULL_TREE);
+	  && (fn == NULL_TREE
+	      || lookup_attribute ("no_sanitize_coverage",
+				   DECL_ATTRIBUTES (fn)) == NULL_TREE));
 }
 
 #endif /* TREE_ASAN */
diff --git a/gcc/testsuite/g++.dg/pr101331.C b/gcc/testsuite/g++.dg/pr101331.C
new file mode 100644
index 00000000000..01b9b3c3a7c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr101331.C
@@ -0,0 +1,7 @@
+// PR c++/101331
+// { dg-do compile }
+// { dg-options "-fsanitize-coverage=trace-pc -O2" }
+
+int a[2];
+int b = 1;
+int c { b && (a[b] = 0) };


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/users/marxin/heads/PR101331-sanitize-coverage-ice)] c++: fix -fsanitize-coverage=trace-pc ICE [PR101331]
@ 2021-08-13  8:05 Martin Liska
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2021-08-13  8:05 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b20236bfcad0fdd1565cbf3821173f2c1db2a261

commit b20236bfcad0fdd1565cbf3821173f2c1db2a261
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Aug 12 17:49:14 2021 +0200

    c++: fix -fsanitize-coverage=trace-pc ICE [PR101331]
    
            PR c++/101331
    
    gcc/ChangeLog:
    
            * asan.h (sanitize_coverage_p): Handle when fn == NULL.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/pr101331.C: New test.

Diff:
---
 gcc/asan.h                      | 5 +++--
 gcc/testsuite/g++.dg/pr101331.C | 7 +++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gcc/asan.h b/gcc/asan.h
index 8c0b2baf170..820c18bbd0a 100644
--- a/gcc/asan.h
+++ b/gcc/asan.h
@@ -255,8 +255,9 @@ static inline bool
 sanitize_coverage_p (const_tree fn = current_function_decl)
 {
   return (flag_sanitize_coverage
-	  && lookup_attribute ("no_sanitize_coverage",
-			       DECL_ATTRIBUTES (fn)) == NULL_TREE);
+	  && (fn == NULL_TREE
+	      || lookup_attribute ("no_sanitize_coverage",
+				   DECL_ATTRIBUTES (fn)) == NULL_TREE));
 }
 
 #endif /* TREE_ASAN */
diff --git a/gcc/testsuite/g++.dg/pr101331.C b/gcc/testsuite/g++.dg/pr101331.C
new file mode 100644
index 00000000000..015aba200d3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr101331.C
@@ -0,0 +1,7 @@
+// PR c++/101331
+// { dg-do compile }
+// { dg-options "-fsanitize-coverage=trace-pc -O2 -std=c++11" }
+
+int a[2];
+int b = 1;
+int c { b && (a[b] = 0) };


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-13  8:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 15:50 [gcc(refs/users/marxin/heads/PR101331-sanitize-coverage-ice)] c++: fix -fsanitize-coverage=trace-pc ICE [PR101331] Martin Liska
2021-08-13  8:05 Martin Liska

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).