On 06/29/2018 06:56 AM, Rainer Orth wrote:
Hi Martin,

While looking into opportunities to detect strnlen/strlen coding
mistakes (pr86199) I noticed a bug in the strnlen implementation
I committed earlier today that lets a strnlen() result be saved
and used in subsequent calls to strlen() with the same argument.
The attached patch changes the handle_builtin_strlen() function
to discard the strnlen() result unless its bound is greater than
the length of the string.

the new test FAILs to link on Solaris 10:

+FAIL: gcc.dg/strlenopt-46.c (test for excess errors)
+UNRESOLVED: gcc.dg/strlenopt-46.c compilation failed to produce executable

Excess errors:
Undefined                       first referenced
 symbol                             in file
strnlen                             /var/tmp//ccyrOY3M.o
ld: fatal: symbol referencing errors. No output written to ./strlenopt-46.exe

I forgot that the strlenopt tests don't define their own library
versions of the tested functions like the ones in
the gcc.c-torture/execute/builtins directory do.  I've added one
in r262255 so the test should link on targets without the function
too.  Please let me know if the problem doesn't clear up.

Martin

Reply via email to