https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104356
--- Comment #9 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > So for Ada it would be valid to optimize it as > > tem = D; > if (tem != 0) > D := 1 / tem; > else > D = tem; > > basically carrying out the division conditionally only? > (I've tried hard to preserve all volatile loads / stores, if not > volatile that can be elided) No, the result of the operation is not dead here (modulo Volatile), so the operation must be performed and therefore raise an exception. To sum up, either you optimize away the final assignment to D or you raise an exception, i.e. D cannot contain a random value.