https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104356
--- Comment #35 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I meant something like: with System.Unsigned_Types; use System.Unsigned_Types; function F (X, Y : Unsigned) return Unsigned is Z : Unsigned; begin if X >=2 then return 0; end if; Z := Y; if X = 1 then Z := Y + 4; end if; return Z / X; end; and there evrp does with -O2 -gnatp optimize away the division. Though that is likely the X / boolean_range_Y case which you've disabled. In any case, I think you want to hear from Andrew/Aldy where exactly does VRP/ranger assume UB on integer division by zero.