[Bug c++/88449] New: __builtin_is_constant_evaluated misbehaves due to constexpr call caching
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 11 11:10:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88449
Bug ID: 88449
Summary: __builtin_is_constant_evaluated misbehaves due to
constexpr call caching
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Target Milestone: ---
The is-constant-evaluated1.C testcase when
constexpr inline bool
is_constant_evaluated () noexcept
{
return __builtin_is_constant_evaluated ();
}
is added and all other __builtin_is_constant_evaluated calls are changed to
is_constant_evaluated fails (if it is made dg-do run) due to C++ constexpr call
caching.
Either we can just use the ctx->pretend_constant_evaluated as another
"argument" for the caching purposes (as the patch I'm going to attach does), or
we could do something smarter (remember during constexpr evaluation whether any
__builtin_is_constant_evaluated calls were seen), remember that in the context
and use a tri-state in the constexpr_call hash table - not seen,
pretend_constant_evaluated true or false. But we'd need to make sure we
propagate it to all the callers right, if it is in the constexpr context,
anytime we create a new context we'd need to or it back afterwards.
More information about the Gcc-bugs
mailing list