Autoscoping can help you decide how to scope variables. However, for some complicated programs, autoscoping might not be successful or the result of autoscoping might not be what you expects. Incorrect scoping can cause inconspicuous yet serious problems. For example, incorrectly scoping a variable as shared may cause a data race; incorrectly privatizing a variable may result in an undefined value for the variable inside the construct.
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 compiler checks the data-sharing attributes specified by the programmer, the predetermined and implicitly determined data-sharing attributes, and the autoscoping results.