https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103830
Bernd Edlinger <bernd.edlinger at hotmail dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |FIXED --- Comment #9 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- (In reply to Richard Biener from comment #7) > A fix in the source would be: > > void MyClass::call() { > volatile char * volatile null = nullptr; > *null = 1; /* line 26 */ > } > > which then compiles to > > movq $0, -8(%rsp) > movq -8(%rsp), %rax > movb $1, (%rax) > ret > > (some "advanced" means using some asm() to hide the constant from the > compiler might also work) Yes, that works, but I would prefer: *(volatile char*)1 = 2;