https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109359
--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:470f501f31a4bdb9fa04c691ca7db2915ac3ae5b commit r12-10136-g470f501f31a4bdb9fa04c691ca7db2915ac3ae5b Author: Jason Merrill <ja...@redhat.com> Date: Thu Jun 1 14:41:07 2023 -0400 varasm: check float size [PR109359] 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. This also fixed the test for PR109359. PR c++/95226 PR c++/109359 gcc/ChangeLog: * varasm.cc (output_constant) [REAL_TYPE]: Check that sizes match. (initializer_constant_valid_p_1): Compare float precision. gcc/testsuite/ChangeLog: * g++.dg/ext/frounding-math1.C: New test. (cherry picked from commit e7cc4d703bceb9095316c106eba0d1939c6c8044)