[Bug c/105495] `__atomic_compare_exchange` prevents tail-call optimization

2022-05-05 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105495 --- Comment #4 from Jakub Jelinek --- The reason why it works in #c1 is that we replace the c = x_4(D); n_6 = 2; n.0_1 = n_6; n.1_2 = (unsigned int) n.0_1; __atomic_compare_exchange_4 (p_7(D), &c, n.1_2, 1, 0, 0); call in the IL with:

[Bug c/105495] `__atomic_compare_exchange` prevents tail-call optimization

2022-05-05 Thread lh_mouse at 126 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105495 --- Comment #3 from LIU Hao --- Wouldn't that go away if the value in it is never read back?

[Bug c/105495] `__atomic_compare_exchange` prevents tail-call optimization

2022-05-05 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105495 Richard Biener changed: What|Removed |Added Last reconfirmed||2022-05-05 Ever confirmed|0

[Bug c/105495] `__atomic_compare_exchange` prevents tail-call optimization

2022-05-05 Thread lh_mouse at 126 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105495 --- Comment #1 from LIU Hao --- A possible workaround is to use a scalar type to provide storage for local variables, and cast them as needed: Godbolt: https://gcc.godbolt.org/z/n7zq7Pn4G ```c typedef struct { int b; } cond; int __MCF_batch_r