https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78529
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #6) > (In reply to prathamesh3492 from comment #5) > > (In reply to Jakub Jelinek from comment #4) > > > The cmp %rax, %rax is just a missed optimization, because we manage to > > > optimize it only so late that nothing cleans it up afterwards. We could > > > optimize this away already in GIMPLE, e.g. for SCCVN use the same VN for > > > return value of pass-through builtin as the corresponding argument (if we > > > don't do that already). > > > That doesn't explain the failure. > > Hmm yes, but I don't understand why should this patch cause the test to > > fail. > > The patch makes following two separate changes: > > > > a) to make gimple_stmt_nonzero_warnv_p (stmt) return true, if stmt is > > function-call, and the function returns one of it's argument and that > > argument is non-null. However this change doesn't make any difference to the > > .evrp > > (and .optimized) dumps for strcat-chk.c > > because the patch expects SSA_VAR_P (arg) to be true, and the argument is > > MEM_REF. > > > > b) The other change was to modify attribute of string builtins like STRCAT, > > STRNCAT, etc. from ATTR_NOTHROW_NONNULL_LEAF > > to ATTR_RET1_NOTHROW_NONNULL_LEAF, which resulted in above code-gen > > difference, but as you mention it's a missed optimization > > and not incorrect. > > > > I would be grateful for suggestions on how to proceed. > > > > As I said, look at the additional sources involved, like > execute/builtins/lib/chk.c, and the effect on those. Btw, I am not seeing the failure on x86_64 either, so if you can't reproduce on aarch64 then ask Bin how to reproduce. > > Thanks, > > Prathamesh