The desired mode of for handling intermediate overflow can be specified using
Overflow_Mode pragma or an equivalent compiler switch.
The pragma has the form
pragma Overflow_Mode ([General =>] MODE [, [Assertions =>] MODE]);
MODE is one of
STRICT: intermediate overflows checked (using base type)
MINIMIZED: minimize intermediate overflows
ELIMINATED: eliminate intermediate overflows
The case is ignored, so
minimized all have the same effect.
If only the
General parameter is present, then the given
to expressions both within and outside assertions. If both arguments
are present, then
General applies to expressions outside assertions,
Assertions applies to expressions within assertions. For example:
pragma Overflow_Mode (General => Minimized, Assertions => Eliminated);
specifies that general expressions outside assertions be evaluated in ’minimize intermediate overflows’ mode, and expressions within assertions be evaluated in ’eliminate intermediate overflows’ mode. This is often a reasonable choice, avoiding excessive overhead outside assertions, but assuring a high degree of portability when importing code from another compiler, while incurring the extra overhead for assertion expressions to ensure that the behavior at run time matches the expected mathematical behavior.
Overflow_Mode pragma has the same scoping and placement
rules as pragma
Suppress, so it can occur either as a
configuration pragma, specifying a default for the whole
program, or in a declarative scope, where it applies to the
remaining declarations and statements in that scope.
Note that pragma
Overflow_Mode does not affect whether
overflow checks are enabled or suppressed. It only controls the
method used to compute intermediate values. To control whether
overflow checking is enabled or suppressed, use pragma
Unsuppress in the usual manner.
Additionally, a compiler switch
can be used to control the checking mode default (which can be subsequently
overridden using pragmas).
? is one of the digits
use base type for intermediate operations (
minimize intermediate overflows (
eliminate intermediate overflows (
As with the pragma, if only one digit appears then it applies to all
cases; if two digits are given, then the first applies outside
assertions, and the second within assertions. Thus the equivalent
of the example pragma above would be
If no digits follow the
-gnato, then it is equivalent to
causing all intermediate operations to be computed using the base