Sun Studio 12: Fortran User's Guide

3.4.123 –xcommonchk[={yes|no}]

Enable runtime checking of common block inconsistencies.

This option provides a debug check for common block inconsistencies in programs using TASK COMMON and parallelization. (See the discussion of the TASK COMMON directive in the “Parallelization” chapter in the Fortran Programming Guide.)

The default is -xcommonchk=no; runtime checking for common block inconsistencies is disabled because it will degrade performance. Use -xcommonchk=yes only during program development and debugging, and not for production-quality programs.

Compiling with -xcommonchk=yes enables runtime checking. If a common block declared in one source program unit as a regular common block appears somewhere else on a TASK COMMON directive, the program will stop with an error message indicating the first such inconsistency. -xcommonchk without a value is equivalent to -xcommonchk=yes.

Example: Missing TASKCOMMON directive in tc.f

demo% cat tc.f
                common /x/y(1000)
                do 1 i=1,1000
 1              y(i) = 1.
                call z(57.)
demo% cat tz.f
                subroutine z(c)
                common /x/h(1000)
                do 1 i=1,1000
1                       h(i) = c* h(i)
demo% f95 -c -O4 -parallel -xcommonchk tc.f
demo% f95 -c -O4 -parallel -xcommonchk tz.f
demo% f95 -o tc -O4 -parallel -xcommonchk tc.o tz.o
demo% tc
ERROR(libmtsk): inconsistent declaration of threadprivate/taskcommon
   x_: not declared as threadprivate/taskcommon at line 1 of tc.f