On 01/01/2018 05:58 PM, Martin Sebor wrote:
> The -Wrestrict code assumes that built-ins are called with
> the correct number of arguments.  When this isn't so it
> crashes.  The attached patch avoids the ICE due to this
> error.
> 
> There are outstanding assumptions that the type of actual
> arguments to built-ins declared without a prototype matches
> the expected type.  Those will be corrected in a subsequent
> patch.
> 
> Martin
> 
> gcc-83603.diff
> 
> 
> PR tree-optimization/83603 - ICE in builtin_memref at 
> gcc/gimple-ssa-warn-restrict.c:238
> 
> gcc/ChangeLog:
> 
>       PR tree-optimization/83603
>       * calls.c (maybe_warn_nonstring_arg): Avoid accessing function
>       arguments past the endof the argument list in functions declared
>       without a prototype.
>       * gimple-ssa-warn-restrict.c (wrestrict_dom_walker::check_call):
>       Avoid checking when arguments are null.
OK.

Presumably we're not getting syntax errors precisely because we're
calling these functions without an in-scope prototype?

I wouldn't at all be surprised to find other passes mis-handling that
case.  The idioms you're using to get the arguments are similar to code
I've seen elsewhere -- it's probably just harder to trigger the failures
because analysis of the mem* or str* call is conditional on surrounding
context.

Jeff

Reply via email to