[Bug tree-optimization/95001] std::terminate() and abort() do not have __builtin_unreachable() semantics

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 8 12:16:07 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95001

--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
Simpler example:

[[noreturn]] void theend();

int f(int x){
  if(x&7)theend();
  return x&3;
}

(or replace "theend()" with "throw 42")

We shouldn't compute x&3, it is always 0 in the branch where it is computed.

But this simple example would probably be doable similarly to VRP, while the
original example requires that the information be available during another pass
(on-demand non-zero bits, like there is work on on-demand ranges?).


More information about the Gcc-bugs mailing list