diff options
author | Jason Merrill <jason@redhat.com> | 2023-06-01 14:41:07 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-06-02 10:08:59 -0400 |
commit | e7cc4d703bceb9095316c106eba0d1939c6c8044 (patch) | |
tree | 36d5e76f0c5db1a027b13f12f49f527a8f6026fe /gcc/expr.cc | |
parent | ef768035ae8090ecbe5726111a5fae4d5c86dd74 (diff) | |
download | gcc-e7cc4d703bceb9095316c106eba0d1939c6c8044.zip gcc-e7cc4d703bceb9095316c106eba0d1939c6c8044.tar.gz gcc-e7cc4d703bceb9095316c106eba0d1939c6c8044.tar.bz2 |
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.
Diffstat (limited to 'gcc/expr.cc')
0 files changed, 0 insertions, 0 deletions