Author Topic: [SOLVED] Why is gcc producing code with an infinite loop in it ?  (Read 2314 times)

0 Members and 1 Guest are viewing this topic.

Offline Alien Brother

  • Regular Contributor
  • *
  • Posts: 63
  • Country: fr
Re: [SOLVED] Why is gcc producing code with an infinite loop in it ?
« Reply #25 on: June 09, 2026, 07:27:47 pm »
Fair enough, I tried with starm-clang and it's trying to compile atomic_load()/atomic_store() into function calls, which is nonsense (GCC is doing the right thing). I guess, if one has no other choice for the toolchain, they would have to implement their own load/store as macros that expand into a combination of __DMB() and assignment (or whatever makes sense on the processor).

The point however still stands that an SPSC queue, a loop checking a ready-flag, and other simple cases need read-acquire and write-release operations. Volatile qualifiers do not implement those, with the exception of single core (maybe also multicore x86) + every single memory access being volatile. Relying on either is a recipe for future headaches in my opinion, but then everyone has their own approach to things.
« Last Edit: June 09, 2026, 08:25:54 pm by Alien Brother »
 
The following users thanked this post: rteodor


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf