On 10/3/18 11:58 AM, Martin Sebor wrote:
> The recent strnlen changes to detect reading past unterminated
> arrays introduced a couple of bugs:
>
> 1) ICE due to assuming that the strnlen argument necessarily
> refers to a known declaration under some conditions.
> 2) Failing to diagnose uses of unterminated arrays in calls
> with a non-constant bound known to be in excess of the size
> of the array.
>
> The attached patch tested on x86_64-linux fixes both of these
> problems.
>
> Martin
>
> gcc-87490.diff
>
> PR tree-optimization/87490 - ICE in expand_builtin_strnlen with a constant
> argument and non-constant bound
>
> gcc/ChangeLog:
>
> PR tree-optimization/87490
> * builtins.c (expand_builtin_strnlen): Handle a null data.decl
> consistently.
>
> gcc/testsuite/ChangeLog:
>
> PR tree-optimization/87490
> * gcc.dg/pr87490.c: New test.
> * gcc.dg/warn-strnlen-no-nul-2.c: Same.
OK.
jeff