This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, MPX, 2/X] Pointers Checker [5/25] Tree and gimple ifaces
- From: Jeff Law <law at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>, Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 30 Oct 2013 11:40:39 -0600
- Subject: Re: [PATCH, MPX, 2/X] Pointers Checker [5/25] Tree and gimple ifaces
- Authentication-results: sourceware.org; auth=none
- References: <20131021122236 dot GE37888 at msticlxl57 dot ims dot intel dot com> <20131024144329 dot GB39638 at msticlxl57 dot ims dot intel dot com> <52700F0A dot 3010606 at redhat dot com> <20131029215323 dot GA46971 at msticlxl57 dot ims dot intel dot com> <CAFiYyc3Y9z_6TigcZYhMbHh=nPNuE7HqpcXK+mQUw=JQmWeCDw at mail dot gmail dot com> <20131030103410 dot GB46971 at msticlxl57 dot ims dot intel dot com> <CAFiYyc2FYcZ-j0+O80QH8pN7aqfhzWJ0ENkcm3a2w0FVD6efew at mail dot gmail dot com>
On 10/30/13 04:48, Richard Biener wrote:
foo (int * p, unsigned int size)
{
<unnamed type> __bound_tmp.0;
long unsigned int D.2239;
long unsigned int _2;
sizetype _6;
int * _7;
<bb 3>:
__bound_tmp.0_4 = __builtin_ia32_arg_bnd (p_3(D));
<bb 2>:
_2 = (long unsigned int) size_1(D);
__builtin_ia32_bndcl (__bound_tmp.0_4, p_3(D));
_6 = _2 + 18446744073709551615;
_7 = p_3(D) + _6;
__builtin_ia32_bndcu (__bound_tmp.0_4, _7);
access_and_store (p_3(D), __bound_tmp.0_4, size_1(D));
so it seems there is now a mismatch between DECL_ARGUMENTS
and the GIMPLE call stmt arguments. How (if) did you amend
the GIMPLE stmt verifier for this?
Effectively the bounds are passed "on the side".
How does regular code deal with this which may expect matching
to DECL_ARGUMENTS? In fact interleaving the additional
arguments sounds very error-prone for existing code - I'd have
appended all bound args at the end. Also you unconditionally
claim all pointer arguments have a bound - that looks like bad
design as well. Why didn't you add a flag to the relevant
PARM_DECL (and then, what do you do for indirect calls?).
You can't actually interleave them -- that results in MPX and normal
code not being able to interact. Passing the bound at the end doesn't
really work either -- varargs and the desire to pass some of the bounds
around in bound registers.
/* Return the number of arguments used by call statement GS
ignoring bound ones. */
static inline unsigned
gimple_call_num_nobnd_args (const_gimple gs)
{
unsigned num_args = gimple_call_num_args (gs);
unsigned res = num_args;
for (unsigned n = 0; n < num_args; n++)
if (POINTER_BOUNDS_P (gimple_call_arg (gs, n)))
res--;
return res;
}
the choice means that gimple_call_num_nobnd_args is not O(1).
Yes, but I don't see that's terribly problematical.
/* Return INDEX's call argument ignoring bound ones. */
static inline tree
gimple_call_nobnd_arg (const_gimple gs, unsigned index)
{
/* No bound args may exist if pointers checker is off. */
if (!flag_check_pointer_bounds)
return gimple_call_arg (gs, index);
return gimple_call_arg (gs, gimple_call_get_nobnd_arg_index (gs, index));
}
GIMPLE layout depending on flag_check_pointer_bounds sounds
like a recipie for desaster if you consider TUs compiled with and
TUs compiled without and LTO. Or if you consider using
optimized attribute with that flag.
Sorry, I don't follow. Can you elaborate please.
I hope the reviewers that approved the patch will work with you to
address the above issues. I can't be everywhere.
Obviously I will.
jeff
- References:
- [PATCH, MPX, 2/X] Pointers Checker [5/25] Tree and gimple ifaces
- Re: [PATCH, MPX, 2/X] Pointers Checker [5/25] Tree and gimple ifaces
- Re: [PATCH, MPX, 2/X] Pointers Checker [5/25] Tree and gimple ifaces
- Re: [PATCH, MPX, 2/X] Pointers Checker [5/25] Tree and gimple ifaces
- Re: [PATCH, MPX, 2/X] Pointers Checker [5/25] Tree and gimple ifaces
- Re: [PATCH, MPX, 2/X] Pointers Checker [5/25] Tree and gimple ifaces
- Re: [PATCH, MPX, 2/X] Pointers Checker [5/25] Tree and gimple ifaces