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

--- Comment #9 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:3c5bccb608c665ac3f62adb1817c42c845812428

commit r13-2828-g3c5bccb608c665ac3f62adb1817c42c845812428
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Sat Sep 24 09:19:26 2022 +0200

    openmp, c: Tighten up c_tree_equal [PR106981]

    This patch changes c_tree_equal to work more like cp_tree_equal, be
    more strict in what it accepts.  The ICE on the first testcase was
    due to INTEGER_CST wi::wide (t1) == wi::wide (t2) comparison which
    ICEs if the two constants have different precision, but as the second
    testcase shows, being too lenient in it can also lead to miscompilation
    of valid OpenMP programs where we think certain expression is the same
    even when it isn't and can be guaranteed at runtime to represent different
    memory location.  So, the patch looks through only NON_LVALUE_EXPRs
    and for constants as well as casts requires that the types match before
    actually comparing the constant values or recursing on the cast operands.

    2022-09-24  Jakub Jelinek  <ja...@redhat.com>

            PR c/106981
    gcc/c/
            * c-typeck.cc (c_tree_equal): Only strip NON_LVALUE_EXPRs at the
            start.  For CONSTANT_CLASS_P or CASE_CONVERT: return false if t1
and
            t2 have different types.
    gcc/testsuite/
            * c-c++-common/gomp/pr106981.c: New test.
    libgomp/
            * testsuite/libgomp.c-c++-common/pr106981.c: New test.

Reply via email to