This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][ubsan] Add VLA bound instrumentation
- From: Marek Polacek <polacek at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Fri, 25 Oct 2013 21:03:56 +0200
- Subject: Re: [PATCH][ubsan] Add VLA bound instrumentation
- Authentication-results: sourceware.org; auth=none
- References: <20130912122655 dot GN23899 at redhat dot com> <20130925124132 dot GJ12296 at redhat dot com> <52697B9D dot 9000502 at redhat dot com> <20131025165803 dot GF27400 at redhat dot com> <526AB5CC dot 60408 at redhat dot com>
On Fri, Oct 25, 2013 at 02:17:48PM -0400, Jason Merrill wrote:
> On 10/25/2013 12:58 PM, Marek Polacek wrote:
> >I've tried to implement the instrumentation in cp_finish_decl.
> >However, the problem is with multidimensional arrays, e.g. for
> >
> >int x = -1;
> >int a[1][x];
> >
> >array_of_runtime_bound_p returns false, thus we don't instrument this
> >at all, nor throw an exception in c++1y mode...
>
> Because the above is not valid under the proposed standard C++ VLA
> support; only the leftmost bound can be variable.
I see.
> I think the right place to handle both ubsan and c++1y VLA checks is
> in compute_array_index_type, in the block where we're calling
> variable_size.
I'm sorry, you want me to move the c++1y VLA check into
compute_array_index_type, or just do the ubsan instrumentation in
there? Thanks,
Marek