https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116775

--- Comment #12 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #11)
> I think just folding the builtin to 0 right away might be easier.  Note,
> seems __builtin_constant_p (0 && ++i) is actually folded to 1, and ditto for
> __builtin_constant_p (({ 0 }) && ++i) so we are able to prove that the
> side-effects won't actually happen at runtime.  But I think we just don't
> want to fold the builtin with co_* in it to 0, users are trying something
> weird.  Even if they actually write __builtin_constant_p (0 && co_await ...)
> and we don't fold it away before coro lowering.

for __builtin_constant_p() I agree early folding to 0 (in the coroutine
lowering) seems the right solution.

for [[assume ((h(), co_await thing))] I have no idea what the user would even
mean by this .. I think although the std does not actually say so - I'd like to
make this ill-formed (at least for now).  ISTM that the await expression always
has to be false ? and that is runtime-UB according to
http://eel.is/c++draft/dcl.attr.assume#1 

for __builtin_has_attribute, when the first parm is an expression, then the
action pertains to the type of the expression - and I think that is reasonable
for an await / yield - will have to see whether that's already handled at a
higher level

for __builtin_choose_expr our doc. says it's C-only, so that bullet is dodged
for now.

Reply via email to