On 3/20/21 11:52 AM, Paolo Bonzini wrote:
+int main(void)
+{
+ return read_y();
+}
I think this should be "read_y() == 1 ? 0 : 1".
As a testcase returning 0 on success, yes.
I can reproduce it with -flto -O2 but not without -flto, do you agree?
Agreed. Replicated with a random recent gcc 11 snapshot.
This is really annoying of lto. It's clear something needs to change though.
Perhaps we can obtain the same optimization by wrapping reads of the page size
in an inline __attribute__((const)) function. Richard, what do you think?
I'll give it a shot and see what happens.
r~