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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:e7cc4d703bceb9095316c106eba0d1939c6c8044

commit r14-1498-ge7cc4d703bceb9095316c106eba0d1939c6c8044
Author: Jason Merrill <ja...@redhat.com>
Date:   Thu Jun 1 14:41:07 2023 -0400

    varasm: check float size

    In PR95226, the testcase was failing because we tried to output_constant a
    NOP_EXPR to float from a double REAL_CST, and so we output a double where
    the caller wanted a float.  That doesn't happen anymore, but with the
    output_constant hunk we will ICE in that situation rather than emit the
    wrong number of bytes.

    Part of the problem was that initializer_constant_valid_p_1 returned true
    for that NOP_EXPR, because it compared the sizes of integer types but not
    floating-point types.  So the C++ front end assumed it didn't need to fold
    the initializer.

            PR c++/95226

    gcc/ChangeLog:

            * varasm.cc (output_constant) [REAL_TYPE]: Check that sizes match.
            (initializer_constant_valid_p_1): Compare float precision.

Reply via email to