summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2017-08-11 10:01:13 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2017-08-11 10:01:13 +0000
commitf5f4a06fc5d3801eebe23f4615c5ac4926d381bf (patch)
tree811303a849108a7aac4ab132aa9d5b1becc7e2df
parent07b8a4124a8bc7ffadb491bade270db8497a9783 (diff)
downloadgcc-f5f4a06fc5d3801eebe23f4615c5ac4926d381bf.tar.gz
Do not instrument void variables with MPX (PR tree-opt/79987).
2017-08-11 Martin Liska <mliska@suse.cz> PR tree-opt/79987 * tree-chkp.c (chkp_get_bounds_for_decl_addr): Do not instrument variables of void type. 2017-08-11 Martin Liska <mliska@suse.cz> PR tree-opt/79987 * gcc.target/i386/mpx/pr79987.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@251049 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/pr79987.c5
-rw-r--r--gcc/tree-chkp.c3
4 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a926516ed77..9be7f17931c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2017-08-11 Martin Liska <mliska@suse.cz>
+ PR tree-opt/79987
+ * tree-chkp.c (chkp_get_bounds_for_decl_addr): Do not instrument
+ variables of void type.
+
+2017-08-11 Martin Liska <mliska@suse.cz>
+
* asan.c (asan_protect_global): Replace ASM_OUTPUT_DEF with
TARGET_SUPPORTS_ALIASES.
* cgraph.c (cgraph_node::create_same_body_alias): Likewise.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 76c07405a0d..80ee13eaaa0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2017-08-11 Martin Liska <mliska@suse.cz>
+ PR tree-opt/79987
+ * gcc.target/i386/mpx/pr79987.c: New test.
+
+2017-08-11 Martin Liska <mliska@suse.cz>
+
PR ipa/81213
* gcc.target/i386/pr81213.c: New test.
diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr79987.c b/gcc/testsuite/gcc.target/i386/mpx/pr79987.c
new file mode 100644
index 00000000000..b3ebda95694
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/pr79987.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx" } */
+
+extern void foo;
+void *bar = &foo; /* { dg-warning "taking address of expression of type .void." } */
diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c
index 12af458fb90..951aec10b3a 100644
--- a/gcc/tree-chkp.c
+++ b/gcc/tree-chkp.c
@@ -3197,6 +3197,9 @@ chkp_get_bounds_for_decl_addr (tree decl)
&& !flag_chkp_incomplete_type)
return chkp_get_zero_bounds ();
+ if (VOID_TYPE_P (TREE_TYPE (decl)))
+ return chkp_get_zero_bounds ();
+
if (flag_chkp_use_static_bounds
&& VAR_P (decl)
&& (TREE_STATIC (decl)