[Bug rtl-optimization/102306] [9/10/11/12 Regression] Volatile pointer dereferenced twice

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 17 08:19:52 GMT 2021


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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Eric Botcazou
<ebotcazou@gcc.gnu.org>:

https://gcc.gnu.org/g:469aad8b5d787c728fbe8b4ec6537385d7815d5a

commit r11-9011-g469aad8b5d787c728fbe8b4ec6537385d7815d5a
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri Sep 17 10:12:12 2021 +0200

    Fix PR rtl-optimization/102306

    This is a duplication of volatile loads introduced during GCC 9 development
    by the 2->2 mechanism of the RTL combiner.  There is already a substantial
    checking for volatile references in can_combine_p but it implicitly assumes
    that the combination reduces the number of instructions, which is of course
    not the case here.  So the fix teaches try_combine to abort the combination
    when it is about to make a copy of volatile references to preserve them.

    gcc/
            PR rtl-optimization/102306
            * combine.c (try_combine): Abort the combination if we are about to
            duplicate volatile references.

    gcc/testsuite/
            * gcc.target/sparc/20210917-1.c: New test.


More information about the Gcc-bugs mailing list