Compiling CAMx_v4.20, i'm getting: /usr/bin/ld: equk_: TLS reference in ./CF_AERO/isocom_v1.6.o mismatches non-TLS reference in ./CMU_AERO/diffund.o ./CMU_AERO/diffund.o: could not read symbols: Bad value collect2: ld returned 1 exit status make[1]: *** [model] Error 1 make[1]: Leaving directory `/home/cow/src/CAMX/CAMx_Bench/CAMx_v4.20/src' make: *** [gfortran_linuxomp] Error 2 The error stems from a common that is used $omp threadprivate in one file and without annotation in another file (which may be an application glitch but ifort deals with this nicely): $ cat inc1.inc COMMON /EQUK/ XK1 c$omp threadprivate(/EQUK/) $ cat inc2.inc COMMON /EQUK/ XK1 $ cat sub1.f SUBROUTINE sub1 INCLUDE 'inc1.inc' END SUBROUTINE sub1 $ cat sub2.f SUBROUTINE sub2 INCLUDE 'inc2.inc' END SUBROUTINE sub2 $ cat main.f call sub1 call sub2 END $ cat Makefile all: sub1.o sub2.o main.o $(FC) $^ $ make FC=gfortran-4.2.orig-HEAD FFLAGS=-fopenmp gfortran-4.2.orig-HEAD -fopenmp -c -o sub1.o sub1.f gfortran-4.2.orig-HEAD -fopenmp -c -o sub2.o sub2.f gfortran-4.2.orig-HEAD -fopenmp -c -o main.o main.f gfortran-4.2.orig-HEAD sub1.o sub2.o main.o /usr/bin/ld: equk_: TLS reference in sub1.o mismatches non-TLS reference in sub2.o sub2.o: could not read symbols: Bad value collect2: ld returned 1 exit status make: *** [all] Error 1 $ gfortran-4.2.orig-HEAD -v Using built-in specs. Target: i686-linux-gnu Configured with: ../../src/gcc-4.2.orig/configure -v --enable-languages=c,c++,fortran,treelang --prefix=/opt/gcc-4.2.orig/ --enable-shared --with-system-zlib --libexecdir=/opt/gcc-4.2.orig/lib --enable-nls --without-included-gettext --enable-threads=posix --program-suffix=-4.2.orig-HEAD --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --disable-libstdcxx-debug --enable-mpfr --disable-werror --enable-checking=release --enable-debug i686-linux-gnu Thread model: posix gcc version 4.2.0 20060930 (experimental)
That testcase is invalid. See OpenMP 2.5 standard, 2.8.2, which states: If a threadprivate directive specifying a common block name appears in one program unit, then such a directive must also appear in every other program unit that contains a COMMON statement specifying the same name. I don't see a big advantage in silently accepting invalid code.