This is the mail archive of the
mailing list for the GCC project.
Re: C++ PATCH for c++/91705 - constexpr evaluation rejects ++/-- on floats
- From: Jason Merrill <jason at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>
- Date: Tue, 10 Sep 2019 16:59:14 -0400
- Subject: Re: C++ PATCH for c++/91705 - constexpr evaluation rejects ++/-- on floats
- References: <20190910161856.GJ14737@redhat.com>
On 9/10/19 11:18 AM, Marek Polacek wrote:
We started to reject this testcase with r269078, whereby we perform constexpr
evaluation on pre-cp_fold_function bodies. In this test that causes a problem
because the offset argument of a PREINCREMENT_EXPR was a FLOAT_EXPR, and then
the call to fold_build2 doesn't produce a REAL_CST and VERIFY_CONSTANT triggers.
So we need to fold the offset. But we can't use cxx_eval_constant_expression
because offset can be stuff like "(int*) 4" which is invalid in constexpr.
But we have fold_simple which uses const_unop, and that is precisely the
function that can bash those FLOAT_EXPRs down to REAL_CSTs.
Bootstrapped/regtested on x86_64-linux, ok for trunk/9?
2019-09-10 Marek Polacek <email@example.com>
PR c++/91705 - constexpr evaluation rejects ++/-- on floats.
* constexpr.c (cxx_eval_increment_expression): Call fold_simple on