Skip to content
Snippets Groups Projects
Commit b1ed0c96 authored by Jakub Jelinek's avatar Jakub Jelinek
Browse files

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.
parent 4b19ff1b
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment