https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106654
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 53600 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53600&action=edit gcc13-pr106654.patch Untested patch, with the more difficult cases optimized away during gimplification, so only the most simple assertions are transformed into if (cond); else __builtin_unreachable (); for now, but the FE handling should be all there, for C++ both as the standard attribute and [[gnu::assume (cond)]] or __attribute__((assume (cond))) with the same behavior, for C just the latter two. Similarly, for C++ constant evaluation, it will diagnose only the simple cases (mainly because we'd need to undo all changes to ctx->globals done during evaluation of the assumption). I believe such behavior in both places is standard conforming, but obviously want to work especially on the former (middle-end representation of those) soon.