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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-09-29
                 CC|                            |msebor at gcc dot gnu.org
      Known to work|                            |7.3.0
             Blocks|                            |89180
            Summary|Invalid report of "set but  |[8/9/10 Regression] Invalid
                   |used variable" with -O      |report of "set but used
                   |                            |variable" with -O
     Ever confirmed|0                           |1
      Known to fail|                            |10.0, 8.3.0, 9.2.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  Bisection points to r254930 as the revision that caused the
regression:

r254930 | jakub | 2017-11-19 12:17:01 -0500 (Sun, 19 Nov 2017) | 28 lines

        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.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89180
[Bug 89180] [meta-bug] bogus/missing -Wunused warnings

Reply via email to