]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: Mangle EXCESS_PRECISION_EXPR <REAL_CST> as fold_convert REAL_CST [PR108698]
authorJakub Jelinek <jakub@redhat.com>
Thu, 9 Feb 2023 08:31:55 +0000 (09:31 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 9 Feb 2023 08:31:55 +0000 (09:31 +0100)
commitb1ed0c9671b99c6b06cbb8c61be14cdec0998de8
tree7a46c33514034237e89ba76bafdc03a36e961840
parent4b19ff1b5ef684c2d9ccd4fb275aeef0a4b0b980
c++: Mangle EXCESS_PRECISION_EXPR <REAL_CST> as fold_convert REAL_CST [PR108698]

For standard excess precision, like the C FE we parse floating
point constants as EXCESS_PRECISION_EXPR of promoted REAL_CST
rather than the nominal REAL_CST, and as the following testcase
shows the constants might need mangling.

The following patch mangles those as fold_convert of the REAL_CST
to EXCESS_PRECISION_EXPR type, i.e. how they were mangled before.

I'm not really sure EXCESS_PRECISION_EXPR can appear elsewhere
in expressions that would need mangling, tried various testcases
but haven't managed to come up with one.  If that is possible,
we'd keep ICEing on it without/with this patch, and the big question
is how to mangle those; they could be mangled as casts from the
promoted type back to nominal, but then in the mangled expressions
one could see the effects of excess precision.  Until we have
a reproducer, that is just theoretical though.

2023-02-09  Jakub Jelinek  <jakub@redhat.com>

PR c++/108698
* mangle.cc (write_expression, write_template_arg): Handle
EXCESS_PRECISION_EXPR with REAL_CST operand as
write_template_arg_literal on fold_convert of the REAL_CST
to EXCESS_PRECISION_EXPR type.

* g++.dg/cpp0x/pr108698.C: New test.
gcc/cp/mangle.cc
gcc/testsuite/g++.dg/cpp0x/pr108698.C [new file with mode: 0644]