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

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:dc8c02ca1cd18f8c22d70cf17b47125fc25ab243

commit r11-748-gdc8c02ca1cd18f8c22d70cf17b47125fc25ab243
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Sun May 31 10:45:21 2020 +0200

    expr: Fix fallout from optimize store_expr from STRING_CST [PR95052]

    > Can't hurt, and debugging the assert tripping is likely a hell of a lot
easier
    > than debugging the resultant incorrect code.   So if it passes, then I'd
say go
    > for it.

    Testing passed, so I've committed it with those asserts (and thankfully
I've
    added them!) but it apparently broke Linux kernel build on arm.

    The problem is that if the STRING_CST is very short, while the full object
    has BLKmode, the short string could very well have
    QImode/HImode/SImode/DImode and in that case it wouldn't take the path that
    copies the string and then clears the remaining space, but different paths
    in which it will ICE because of those asserts and without those it would
    just emit wrong-code.

    The following patch fixes it by enforcing BLKmode for the string MEM, even
    if it is short, so that we copy it and memset the rest.

    2020-05-31  Jakub Jelinek  <ja...@redhat.com>

            PR middle-end/95052
            * expr.c (store_expr): For shortedned_string_cst, ensure temp has
            BLKmode.

            * gcc.dg/pr95052.c: New test.

Reply via email to