I have an old Fortran program which uses common data blocks, and I need to use it with my new code. My new code uses OpenMP, and because of a compiler bug in array pointers which are threadprivate (see this thread) I use the '-openmp-threadprivate compat' flag. The problem is this flag causes a bug with threadprivate common data blocks. Consider the following test program, which is made of three files. First is 'iblock.com':
integer :: inum save/iblock/ common/iblock/inum !$omp threadprivate(/iblock/)
black data bdata include 'iblock.com' data inum/7/ end
program test include 'iblock.com' write(*,*) inum end program test
I have compiled this test program with the Intel Fortran compiler (version 11), with the '-openmp-threadprivate compat' flag (and the '-openmp' flag of course), and it printed 0 (instead of 7). When the threadprivate directive is removed, it works correctly (prints 7). Without the '-openmp-threadprivate compat' flag, it works correctly anyway, even with the threadprivate directive present.
Can anyone help?