> Can you please explain this stmt_set_p stuff? dont_invalidate should be > only set on strinfos that will be seen by the immediately following > maybe_invalidate call (at the end of handle_builtin_strcpy caller - > strlen_optimize_stmt). If you set it on which unshare_strinfo is called, > if there is no unsharing, it is obviously fine, but if there is unsharing, > then dont_invalidate will be set on some strinfo that won't be seen by the > next may_invalidate. It might trigger in some other basic block and might > cause wrong code.
It's not needed. I've retested it with the following loop instead. No regressions on s390x and x86_64. Ok to apply? + + if (dsi->prev != 0 && (chainsi = verify_related_strinfos (dsi)) != NULL) + { + for (; chainsi && chainsi != dsi; chainsi = get_strinfo (chainsi->next)) + { + /* When setting a stmt for delayed length computation + prevent all strinfos through dsi from being + invalidated. */ + chainsi = unshare_strinfo (chainsi); + chainsi->stmt = stmt; + chainsi->length = NULL_TREE; + chainsi->endptr = NULL_TREE; + chainsi->dont_invalidate = true; + } + } Bye, -Andreas-