https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79313
Bug ID: 79313 Summary: associate statement inside openmp loop breaks OMP intrinisics Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: mlevy at ucar dot edu Target Milestone: --- Created attachment 40642 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40642&action=edit Toy problem highlighting the issue I get the following build-time errors if I try to access omp_get_thread_num() and omp_get_num_threads() in an associate block [which has nothing to do with those functions] while inside an OpenMP loop: $ gfortran -fopenmp omptest.F90 omptest.F90:28:18: write(*,100) omp_get_thread_num(), omp_get_num_threads() 1 Error: 'omp_get_thread_num' at (1) is not a function omptest.F90:28:40: write(*,100) omp_get_thread_num(), omp_get_num_threads() 1 Error: 'omp_get_num_threads' at (1) is not a function If I remove the associate block (comment out lines 27 & 29) then the code compiles and runs as expected* I have verified that this error occurs with gfortran 4.6.4, 4.7.4, 4.8.5, 4.9.3, 5.0.1, 5.1.0, 5.2.0, 5.3.0, 5.4.0, 6.0.1, 6.1.0, and 6.3.0; 4.4.7 does not support associate statements and I do not have easy access to a machine with 4.5.Z or 6.2.Z (4.5 may predate associates as well). * Expected output with 2 threads: $ export OMP_NUM_THREADS=2 $ ./a.out thread 0 / 2 thread 1 / 2 thread 0 / 1 thread 0 / 1