[Bug c++/103114] [12 Regression] ICE in build_complex, at tree.c:2470 since r12-4764-ga84b9d5373c7e67f

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 9 14:30:16 GMT 2021


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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:0318df0ae63e47f6b2f30e96205d00dcb3696538

commit r12-5054-g0318df0ae63e47f6b2f30e96205d00dcb3696538
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Nov 9 15:29:36 2021 +0100

    c++: Fix ICE on complex constant with -frounding-math [PR103114]

    The FE uses build_complex which assumes that fold_convert will fold
    value to a constant.  With -frounding-math that isn't guaranteed though.
    So, the patch instead fold_build2s COMPLEX_EXPR, which will result
    in build_complex if both arguments are constants, and otherwise
    will build COMPLEX_EXPR.
    build_zero_cst is an optimization for fold_convert (type,
integer_zero_node).

    2021-11-09  Jakub Jelinek  <jakub@redhat.com>

            PR c++/103114
            * parser.c (cp_parser_userdef_numeric_literal): Use fold_build2
            with COMPLEX_EXPR arg instead of build_complex, use build_zero_cst
            instead of fold_convert from integer_zero_node.

            * g++.dg/ext/complex10.C: New test.


More information about the Gcc-bugs mailing list