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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Xi Ruoyao <xry...@gcc.gnu.org>:

https://gcc.gnu.org/g:45641f3a99281bb0a429649741a29c2aace4c63e

commit r13-6690-g45641f3a99281bb0a429649741a29c2aace4c63e
Author: Xi Ruoyao <xry...@xry111.site>
Date:   Wed Mar 15 15:34:52 2023 +0800

    builtins: Move the character difference into result instead of reassigning
result [PR109086]

    expand_simple_binop() is allowed to allocate a new pseudo-register and
    return it, instead of forcing the result into the provided
    pseudo-register.  This can cause a problem when we expand the unrolled
    loop for __builtin_strcmp: the compiler always generates code for all n
    iterations of the loop, so "result" will be an alias of the
    pseudo-register allocated and used in the last iteration; but at runtime
    the loop can break early, causing this pseudo-register uninitialized.

    Emit a move instruction in the iteration to force the difference into
    one register which has been allocated before the loop, to avoid this
    issue.

    gcc/ChangeLog:

            PR other/109086
            * builtins.cc (inline_string_cmp): Force the character
            difference into "result" pseudo-register, instead of reassign
            the pseudo-register.

Reply via email to