On 03/21/2018 01:44 PM, Jakub Jelinek wrote:
On Wed, Mar 21, 2018 at 01:40:08PM +0100, Martin Liška wrote:
2018-03-21 Martin Liska <mli...@suse.cz>
PR target/84988
* config/i386/i386.c (ix86_function_arg_advance): Do not call
chkp_type_bounds_count if MPX is not enabled.
---
gcc/config/i386/i386.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 5b1e962dedb..0693f8fc451 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -8618,7 +8618,8 @@ ix86_function_arg_advance (cumulative_args_t cum_v,
machine_mode mode,
if (cum->caller)
cfun->machine->outgoing_args_on_stack = true;
- cum->bnds_in_bt = chkp_type_bounds_count (type);
+ if (type && POINTER_BOUNDS_TYPE_P (type))
+ cum->bnds_in_bt = chkp_type_bounds_count (type);
This is weird. POINTER_BOUNDS_TYPE_P (type)
is TREE_CODE (type) == POINTER_BOUNDS_TYPE,
and for POINTER_BOUNDS_TYPE chkp_type_bounds_count will just unconditionally
return 0.
Jakub
Ok, so should we make the set of cum->bnds_in_bt based on
flag_check_pointer_bounds flag?
If so, I've got patch that I've tested on my x86_64-linux-gnu machin.
Martin
>From 7b5978e61305c5098a084c2352fcbacb4c347158 Mon Sep 17 00:00:00 2001
From: marxin <mli...@suse.cz>
Date: Wed, 21 Mar 2018 10:51:32 +0100
Subject: [PATCH] Do not call chkp_type_bounds_count if MPX is not enabled (PR
target/84988).
gcc/ChangeLog:
2018-03-21 Martin Liska <mli...@suse.cz>
PR target/84988
* config/i386/i386.c (ix86_function_arg_advance): Do not call
chkp_type_bounds_count if MPX is not enabled.
---
gcc/config/i386/i386.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b4f6aec1434..2b2896f7ac6 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -8618,7 +8618,8 @@ ix86_function_arg_advance (cumulative_args_t cum_v, machine_mode mode,
if (cum->caller)
cfun->machine->outgoing_args_on_stack = true;
- cum->bnds_in_bt = chkp_type_bounds_count (type);
+ if (flag_check_pointer_bounds)
+ cum->bnds_in_bt = chkp_type_bounds_count (type);
}
}
--
2.16.2