On 6/16/25 4:00 PM, Iain Sandoe wrote:
Hi Jason
On 11 Jun 2025, at 23:50, Jason Merrill <ja...@redhat.com> wrote:
On 6/9/25 4:12 PM, Iain Sandoe wrote:
There was some discussion of this in the PR116775 comments. In the
end I have matched what clang does in this circumstance, since that
seems reasonable - and we may ignore the attributes as needed.
+ warning_at (loc_n, OPT_Wattributes,"assumption ignored"
+ " because it contains possible side-effects");
+ *stmt = build_empty_stmt (loc_n);
+ }
+ }
Why is this in coroutines.cc?
Because, at the moment I am not sure where else it can be handled ( although I
have now a semi-propsal, below ).
await expressions, when [normally] lowered, depend on and effect the state of
the function (that is, they are lowered to something that alters the code of
the function - which cannot work in the intent of an assumption).
we are permitted to ignore these attributes, and therefore punting on them when
they contain await expressions seemed a reasonable initial stance.
I agree, but your patch doesn't check for await expressions, it just
checks TREE_SIDE_EFFECTS.
Ah, I guess we don't get into analyze_expression_awaits unless we've
already found an await?
So I guess this approach is fine, but the warning should mention awaits
rather than the general "possible side-effects". OK with that tweak.
Jason