------- Comment #3 from janus at gcc dot gnu dot org 2009-12-26 20:11 ------- There is a pass 'diagnose_omp_blocks', which generates the error message for the C code. Its execution function is 'diagnose_omp_structured_block_errors' in omp-low.x, which is correctly called also for Fortran code. However, the checks in 'diagnose_sb_0' and 'diagnose_sb_2' don't seem to work for the Fortran test case.
For the C code in comment #2, the GIMPLE_RETURN branch in diagnose_sb_2 is in effect and calls diagnose_sb_0, which throws the errror. For the Fortran case this does not work, since the RETURN is translated to a GOTO. However, GOTOs jumping out of an OMP CRITICAL section should also be rejected. (I still don't see where things go wrong.) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42484