Autoscoping can help the programmer decide how to scope variables. However, for some complicated programs, autoscoping may not be successful or the result of autoscoping may not be what the programmer expects. Incorrect scoping may cause many inconspicuous yet serious problems. For example, incorrectly scoping some variable as SHARED may cause a data race; incorrectly privatizing a variable may result in an undefined value for the variable outside the construct.
Solaris Studio C, C++, and Fortran compilers provide a compile-time scope-checking feature where the compiler determines whether variables in an OpenMP program are correctly scoped.
Based on the compiler's capabilities, scope checking can discover potential problems including data races, inappropriate privatization or reduction of variables, and other scoping issues. During scope checking, the data-sharing attributes specified by the programmer, the implicit data-sharing attributes determined by the compiler, and autoscoping results are all checked by the compiler.