As for assert(0) in non-release code, it is still possible to catch it, so there's not much in the way of optimising around that. :-) I can have a look, but as far as I recall, gcc optimizer should treat it as noreturn. Whether or not noreturn implies that everything in scope afterwards is unreachable depends the optimizer too.