[Bug c++/94955] [10/11 Regression] ICE in to_wide

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 18 23:06:46 GMT 2020


--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:


commit r11-474-g2d4e1e144c25e526e4f668be5a0bc10d0c1c738c
Author: Marek Polacek <polacek@redhat.com>
Date:   Wed May 6 15:53:33 2020 -0400

    c++: ICE when shortening right shift [PR94955]

    Since r10-6527 fold_for_warn calls maybe_constant_value, which means it
    can fold more than it previously could.  In this testcase it means that
    cp_build_binary_op/RSHIFT_EXPR set short_shift because now we were able
    to fold op1 to an INTEGER_CST.  But then when actually performing the
    shortening we crashed because cp_fold_rvalue wasn't able to fold as much
    as f_f_w and so tree_int_cst_sgn crashed on a NOP_EXPR.  Therefore the
    calls should probably match.

            PR c++/94955
            * typeck.c (cp_build_binary_op): Use fold_for_warn instead of

            * g++.dg/cpp0x/constexpr-shift2.C: New test.

More information about the Gcc-bugs mailing list