* [PATCH] Do not instrument void variables with MPX (PR tree-opt/79987).
@ 2017-08-10 8:53 Martin Liška
2017-08-11 2:58 ` Ilya Enkovich
0 siblings, 1 reply; 3+ messages in thread
From: Martin Liška @ 2017-08-10 8:53 UTC (permalink / raw)
To: gcc-patches; +Cc: aivchenk, Ilya Enkovich
[-- Attachment #1: Type: text/plain, Size: 712 bytes --]
Hello.
In order to prevent the ICE, CHKP should not isntrument variables of void type.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
Ready to be installed?
Martin
gcc/ChangeLog:
2017-08-09 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.
gcc/testsuite/ChangeLog:
2017-08-09 Martin Liska <mliska@suse.cz>
PR tree-opt/79987
* gcc.target/i386/mpx/pr79987.c: New test.
---
gcc/testsuite/gcc.target/i386/mpx/pr79987.c | 5 +++++
gcc/tree-chkp.c | 3 +++
2 files changed, 8 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pr79987.c
[-- Attachment #2: 0001-Do-not-instrument-void-variables-with-MPX-PR-tree-op.patch --]
[-- Type: text/x-patch, Size: 858 bytes --]
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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Do not instrument void variables with MPX (PR tree-opt/79987).
2017-08-10 8:53 [PATCH] Do not instrument void variables with MPX (PR tree-opt/79987) Martin Liška
@ 2017-08-11 2:58 ` Ilya Enkovich
2017-08-11 11:50 ` Martin Liška
0 siblings, 1 reply; 3+ messages in thread
From: Ilya Enkovich @ 2017-08-11 2:58 UTC (permalink / raw)
To: Martin Liška; +Cc: gcc-patches, Alexander Ivchenko
2017-08-10 10:40 GMT+03:00 Martin Liška <mliska@suse.cz>:
> Hello.
>
> In order to prevent the ICE, CHKP should not isntrument variables of void type.
Hi,
There was another thread for this PR where I proposed a way to handle such vars
via size relocations. But there was no feedback in that thread for two
months and
skipping void var is better than ICE. The patch is OK then.
Thanks,
Ilya
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?
> Martin
>
> gcc/ChangeLog:
>
> 2017-08-09 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.
>
> gcc/testsuite/ChangeLog:
>
> 2017-08-09 Martin Liska <mliska@suse.cz>
>
> PR tree-opt/79987
> * gcc.target/i386/mpx/pr79987.c: New test.
> ---
> gcc/testsuite/gcc.target/i386/mpx/pr79987.c | 5 +++++
> gcc/tree-chkp.c | 3 +++
> 2 files changed, 8 insertions(+)
> create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pr79987.c
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Do not instrument void variables with MPX (PR tree-opt/79987).
2017-08-11 2:58 ` Ilya Enkovich
@ 2017-08-11 11:50 ` Martin Liška
0 siblings, 0 replies; 3+ messages in thread
From: Martin Liška @ 2017-08-11 11:50 UTC (permalink / raw)
To: Ilya Enkovich; +Cc: gcc-patches, Alexander Ivchenko
On 08/11/2017 01:51 AM, Ilya Enkovich wrote:
> 2017-08-10 10:40 GMT+03:00 Martin Liška <mliska@suse.cz>:
>> Hello.
>>
>> In order to prevent the ICE, CHKP should not isntrument variables of void type.
>
> Hi,
>
> There was another thread for this PR where I proposed a way to handle such vars
> via size relocations. But there was no feedback in that thread for two
> months and
> skipping void var is better than ICE. The patch is OK then.
Yep, probably does not worth doing that with relocations.
Thanks for review.
Martin
>
> Thanks,
> Ilya
>
>>
>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>>
>> Ready to be installed?
>> Martin
>>
>> gcc/ChangeLog:
>>
>> 2017-08-09 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.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2017-08-09 Martin Liska <mliska@suse.cz>
>>
>> PR tree-opt/79987
>> * gcc.target/i386/mpx/pr79987.c: New test.
>> ---
>> gcc/testsuite/gcc.target/i386/mpx/pr79987.c | 5 +++++
>> gcc/tree-chkp.c | 3 +++
>> 2 files changed, 8 insertions(+)
>> create mode 100644 gcc/testsuite/gcc.target/i386/mpx/pr79987.c
>>
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-11 10:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-10 8:53 [PATCH] Do not instrument void variables with MPX (PR tree-opt/79987) Martin Liška
2017-08-11 2:58 ` Ilya Enkovich
2017-08-11 11:50 ` Martin Liška
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).