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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Sun Nov 19 17:17:01 2017
New Revision: 254930

URL: https://gcc.gnu.org/viewcvs?rev=254930&root=gcc&view=rev
Log:
        PR c/66618
        PR c/69960
c-family/
        * c-common.h (c_fully_fold): Add LVAL argument defaulted to false.
c/
        * c-parser.c (c_parser_omp_atomic): Pass true as LVAL to c_fully_fold
        where needed.
        * c-typeck.c (build_unary_op, build_modify_expr, build_asm_expr,
        handle_omp_array_sections): Likewise.
        (digest_init): Don't call decl_constant_value_for_optimization.
        * c-tree.h (decl_constant_value_for_optimization): Removed.
        * c-fold.c (c_fold_array_ref): New function.
        (c_fully_fold_internal): Add LVAL argument, propagate it through
        recursive calls.  For VAR_P call decl_constant_value and
        unshare if not LVAL and either optimizing or IN_INIT.  Remove
        decl_constant_value_for_optimization calls.  If IN_INIT and not LVAL,
        fold ARRAY_REF with STRING_CST and INTEGER_CST operands.
        (c_fully_fold): Add LVAL argument, pass it through to
        c_fully_fold_internal.
        (decl_constant_value_for_optimization): Removed.
cp/
        * cp-gimplify.c (c_fully_fold): Add LVAL argument, call
        cp_fold_maybe_rvalue instead of cp_fold_rvalue and pass it !LVAL.
testsuite/
        * gcc.dg/pr69960.c: New test.
        * gcc.dg/pr66618.c: New test.
        * gcc.dg/pr66618-2.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr66618-2.c
    trunk/gcc/testsuite/gcc.dg/pr66618.c
    trunk/gcc/testsuite/gcc.dg/pr69960.c
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.h
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-fold.c
    trunk/gcc/c/c-parser.c
    trunk/gcc/c/c-tree.h
    trunk/gcc/c/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-gimplify.c
    trunk/gcc/testsuite/ChangeLog

Reply via email to