On 08/27/2018 04:57 PM, Martin Sebor wrote:
> The assertion I added in the fix for PR 87059 to help find
> mismatched MIN/MAX_EXPR operands has exposed another instance
> of such a mismatch, this one in expand_builtin_strnlen().
>
> The attached patch adjusts the function to convert the signed
> result of c_strlen() to the unsigned type of the second strnlen
> argument.
>
> Martin
>
> gcc-87112.diff
>
>
> PR tree-optimization/87112 - ICE in fold_binary_loc on strnlen of mixed
> integer types
>
> gcc/ChangeLog:
>
> PR tree-optimization/87112
> * builtins.c (expand_builtin_strnlen): Convert c_strlen result to
> the type of the bound argument.
>
> gcc/testsuite/ChangeLog:
>
> PR tree-optimization/87112
> * gcc.dg/pr87112.c: New test.
OK.
jeff