https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71432
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The code in handle_builtin_memcmp looks as follows:
FOR_EACH_IMM_USE_FAST (use_p, iter, res)
{
gimple *ustmt = USE_STMT (use_p);
if (gimple_code (ustmt) == GIMPLE_ASSIGN)
...
else if (gimple_code (ustmt) == GIMPLE_COND)
...
else
return true;
}
Note the "else return true;". I wonder whether it should be removed for good -
or whether it makes indeed sense to abort with "true" after the first loop
iteration.
In any case, with debug symbols, I get a bunch of GIMPLE_DEBUG statements
before the the GIMPLE_COND. Hence, the debug compare issue is fixed by the
following patch:
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index 5e2d7db..bb90339 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -1883,5 +1883,5 @@ handle_builtin_memcmp (gimple_stmt_iterator *gsi)
return true;
}
- else
+ else if (gimple_code (ustmt) != GIMPLE_DEBUG)
return true;
}