https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106654
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Pilar Latiesa from comment #5) > (In reply to Jakub Jelinek from comment #4) > > Note, I think for [[assume(i == j)]]; we can just emit if (i == j) ; else > > __builtin_unreachable (); > > It would be great if the attribute were somewhat cleverer than that. You've cut the second part of sentence, the above was meant for !TREE_SIDE_EFFECTS conditions and the rest is about how to treat conditions which do have side-effects (and that we should probably use more than just TREE_SIDE_EFFECTS test, but watch for any expressions that could possibly raise exceptions, or fault or trap). For the simple cases, we already can handle it without actually invoking anything at runtime and it will be cheaper compile time to handle it as before, for the more complex expressions sure, we need to come up with something new and make ranger and perhaps other optimizations be able to cope with it. BTW, the C++ paper mentions clang __builtin_assume, but that one seems to do roughly what our if (cond) ; else __builtin_unreachable (); does (which they I think support too) only if the expression doesn't contain side-effects. If it does, it warns and doesn't do anything at all.