Re: [PATCH] configure: Improve alias attribute check

2021-03-22 Thread Gavin Shan
Hi Richard, On 3/23/21 7:59 AM, Richard Henderson wrote: On 3/22/21 4:54 AM, Gavin Shan wrote: It looks this issue can be avoided after "volatile" is applied to @target_page. However, I'm not sure if it's the correct fix to have. Certainly not. That is the exact opposite of what we want.  We

Re: [PATCH] configure: Improve alias attribute check

2021-03-22 Thread Richard Henderson
On 3/22/21 4:54 AM, Gavin Shan wrote: It looks this issue can be avoided after "volatile" is applied to @target_page. However, I'm not sure if it's the correct fix to have. Certainly not. That is the exact opposite of what we want. We want to minimize the number of reads from the variable, n

Re: [PATCH] configure: Improve alias attribute check

2021-03-22 Thread Gavin Shan
Hi Richard and Paolo, On 3/22/21 5:23 AM, Richard Henderson wrote: On 3/21/21 11:46 AM, Paolo Bonzini wrote: HRM, what about biting the bullet and making exec-vary.c a C++ source?... Then instead of making it conditional an attribute((alias)), we make it conditional on having a C++ compiler.

Re: [PATCH] configure: Improve alias attribute check

2021-03-21 Thread Richard Henderson
On 3/21/21 11:46 AM, Paolo Bonzini wrote: HRM, what about biting the bullet and making exec-vary.c a C++ source?... Then instead of making it conditional an attribute((alias)), we make it conditional on having a C++ compiler. Doesn't help. The gcc bug I filed talks about c++, because that's t

Re: [PATCH] configure: Improve alias attribute check

2021-03-21 Thread Paolo Bonzini
HRM, what about biting the bullet and making exec-vary.c a C++ source?... Then instead of making it conditional an attribute((alias)), we make it conditional on having a C++ compiler. Making cpu-all.h compile as C++ would be complex, but we can isolate all the required declarations in a separate h

Re: [PATCH] configure: Improve alias attribute check

2021-03-21 Thread Paolo Bonzini
Il dom 21 mar 2021, 18:34 Richard Henderson ha scritto: > On 3/21/21 10:50 AM, Paolo Bonzini wrote: > > Another workaround may be to avoid compiling exec-vary.c with > -flto. I'm not > > sure that my meson fu is up to that. Paolo? > > > > You would have to define a static library. > > O

Re: [PATCH] configure: Improve alias attribute check

2021-03-21 Thread Richard Henderson
On 3/21/21 10:50 AM, Paolo Bonzini wrote: Another workaround may be to avoid compiling exec-vary.c with -flto.  I'm not sure that my meson fu is up to that.  Paolo? You would have to define a static library. Ok. With an extra -fno-lto flag, or can I somehow remove -flto from the lib

Re: [PATCH] configure: Improve alias attribute check

2021-03-21 Thread Paolo Bonzini
Il dom 21 mar 2021, 16:49 Richard Henderson ha scritto: > What exact version of gcc are you guys using? Something from rawhide that > I can just install? > I am using Fedora 34. I upgraded just to test this bug and it seems stable except that GNOME Shell extensions need an upgrade. However I ha

Re: [PATCH] configure: Improve alias attribute check

2021-03-21 Thread Richard Henderson
On 3/20/21 4:33 PM, Richard Henderson wrote: 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 agre

Re: [PATCH] configure: Improve alias attribute check

2021-03-20 Thread Gavin Shan
Hi Paolo and Richard, On 3/21/21 9:33 AM, Richard Henderson wrote: 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. Ok. I will include the changes in v2. Also,

Re: [PATCH] configure: Improve alias attribute check

2021-03-20 Thread Gavin Shan
Hi Thomas, On 3/20/21 3:48 PM, Thomas Huth wrote: On 20/03/2021 05.27, Gavin Shan wrote: It's still possible that the wrong value is returned from the alias of variable even if the program can be compiled without issue. This improves the check by executing the binary to check the result. If al

Re: [PATCH] configure: Improve alias attribute check

2021-03-20 Thread Richard Henderson
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

Re: [PATCH] configure: Improve alias attribute check

2021-03-20 Thread Paolo Bonzini
On 20/03/21 05:27, Gavin Shan wrote: It's still possible that the wrong value is returned from the alias of variable even if the program can be compiled without issue. This improves the check by executing the binary to check the result. If alias attribute can't be working properly, the @target_p

Re: [PATCH] configure: Improve alias attribute check

2021-03-19 Thread Thomas Huth
On 20/03/2021 05.27, Gavin Shan wrote: It's still possible that the wrong value is returned from the alias of variable even if the program can be compiled without issue. This improves the check by executing the binary to check the result. If alias attribute can't be working properly, the @target

[PATCH] configure: Improve alias attribute check

2021-03-19 Thread Gavin Shan
It's still possible that the wrong value is returned from the alias of variable even if the program can be compiled without issue. This improves the check by executing the binary to check the result. If alias attribute can't be working properly, the @target_page in exec-vary.c will always return z