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

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Oct 11 07:36:07 2019
New Revision: 276860

URL: https://gcc.gnu.org/viewcvs?rev=276860&root=gcc&view=rev
Log:
        PR c++/91987
cp/
        * decl2.c (grok_array_decl): For -fstrong-eval-order, when array ref
        operands have been swapped and at least one operand has side-effects,
        revert the swapping before calling build_array_ref.
        * typeck.c (cp_build_array_ref): For non-ARRAY_TYPE array ref with
        side-effects on the index operand, if -fstrong-eval-order use
        save_expr around the array operand.
        (cp_build_binary_op): For shifts with side-effects in the second
        operand, wrap first operand into SAVE_EXPR and evaluate it before
        the shift.
        * semantics.c (handle_omp_array_sections_1): Temporarily disable
        flag_strong_eval_order during OMP_CLAUSE_REDUCTION array section
        processing.
        * cp-gimplify.c (gimplify_to_rvalue): New function.
        (cp_gimplify_expr): Use it.
testsuite/
        * g++.dg/cpp1z/eval-order6.C: New test.
        * g++.dg/cpp1z/eval-order7.C: New test.
        * g++.dg/cpp1z/eval-order8.C: New test.
        * c-c++-common/gomp/pr91987.c: New test.

Added:
    trunk/gcc/testsuite/c-c++-common/gomp/pr91987.c
    trunk/gcc/testsuite/g++.dg/cpp1z/eval-order6.C
    trunk/gcc/testsuite/g++.dg/cpp1z/eval-order7.C
    trunk/gcc/testsuite/g++.dg/cpp1z/eval-order8.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-gimplify.c
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog

Reply via email to