https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107554

--- Comment #1 from Nikita Voronov <nik_1357 at mail dot ru> ---
I debugged a little and found out that this bug is caused when size of object
which has type of "long int" is being assigned to local variable of type "int".

Here's patch which fixed bug for me:
diff --git a/gcc/tree-ssa-strlen.cc b/gcc/tree-ssa-strlen.cc
index 5afbae1b72e..7789b792341 100644
--- a/gcc/tree-ssa-strlen.cc
+++ b/gcc/tree-ssa-strlen.cc
@@ -4735,7 +4735,7 @@ strlen_pass::count_nonzero_bytes (tree exp, gimple *stmt,

   /* Compute the number of leading nonzero bytes in the representation
      and update the minimum and maximum.  */
-  unsigned n = prep ? strnlen (prep, nbytes) : nbytes;
+  unsigned HOST_WIDE_INT n = prep ? strnlen (prep, nbytes) : nbytes;

   if (n < lenrange[0])
     lenrange[0] = n;

Reply via email to