Sun Studio 12: Fortran Programming Guide

9.1.1.11 Add PRAGMA ASSUME Assertions

By adding ASSUME directives at strategic points in the source code you can help guide the compiler’s optimization stragegy by revealing important information about the program that is not determinable any other way. For example, you can let the compiler know that the trip count of a DO loop is always greater than a value, or that there is a high probability that an IF branch will not be taken. The compiler can use this information to generate better code, based on these assertions.

As an added bonus, the programmer can use the ASSUME pragma to validate the exectution of the program by enabling warning messages to be issued whenever an assertion turns out to be false at run time.

For details, see the description of the ASSUME pragma in Chapter 2 of the Fortran User’s Guide, and the -xassume_control compiler command-line option in Chapter 3 of that manual.