https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103194
--- Comment #13 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Hongtao.liu from comment #8)
> unsigned long pscc_a_2_3;
> int pscc_a_1_4;
> unsigned long pc2;
> void pscc(int n)
> {
> long mask = 1ll << n;
> pc2 = __sync_fetch_and_or(&pscc_a_2_3, mask) & mask;
> }
>
> void pscc1(int n)
> {
> long mask = 1ll << 65;
> pc2 = __sync_fetch_and_or(&pscc_a_2_3, mask) & mask;
> }
>
> pscc and pscc1 have different behavior when n >= 64, It seems unsafe to
> optimize variable mask?
Is the behavior well defined for n >= 64? I got
foo.c:11:19: warning: left shift count >= width of type
[-Wshift-count-overflow]
11 | long mask = 1ll << 65;
| ^~