https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115770
Manuel Köppen <manuel.koeppen at gmx dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |FIXED --- Comment #5 from Manuel Köppen <manuel.koeppen at gmx dot de> --- Even if something is "undefined", the compiler should not output broken code, without any warning (nothing, even with -pedantic). The optimizer is optimizing out my perfectly fine asm volatile block, just because it thinks the value passed to it is undefined? Then he replaces it with an invalid instruction. I struggle to even call this an optimization! The standard does not actually define reading memory at address 0 as undefined, because NULL and 0 don't necessarily need to be the same (athough they almost always are). To the very least, there should be a warning like Warning: Intentionally inserted invalid opcode (use of potentially undefined value). Following your argumentation, when an undefined value from stack is used, also this udf opcode should be inserted, to be consistent.