Search code examples
cgcclabelvolatile

Can a label (branch target) be labeled "volatile" to prevent it from being touched by GCC optimizations?


Is it possible to have volatile labels? Something like this:

volatile coroutine:

or

coroutine volatile:

or maybe even

coroutine: volatile

I want a label that won't be touched by optimizations. Is that possible? GCC extensions are acceptable.


Solution

  • Short answer: NO.

    Longer answer: labels are there only to specify jump targets. They are not to be kept in registers or in cache memory (the thing where volatile is involved).