|
|
|
|
|
by p_l
758 days ago
|
|
It's not UB. It's also not covered by standard - it's implementation-specified. What will happen is dependant on decision of compiler writers. It is, however, not the only way to write to memmapped registers. The original C way of doing so was to use an assembly function wrapping the actual act of reading/writing (honestly, better than doing the above, as it helps making it very explicit how the write will happen as well as abstracting any details like needing to add a barrier or whatsoever), the other way was to specify the symbol with address of the memmapped register in assembly, and link resulting object with C code. A C implementation is, AFAIK, free to refuse the literal addresses used as pointers and pass as ISO C. |
|
At least they don't without LTO.