------- Comment #2 from janus at gcc dot gnu dot org 2009-12-25 20:36 -------
Sorry. Of course the code is *not* valid. Section 1.2.2 of the OpenMP 3.0 specification says: "The point of exit cannot be a branch out of the structured block." Also, an analogous example in C is correctly rejected: void sub () { int nRead; #pragma omp critical if (nRead<3) return; } In function sub: error: invalid branch to/from an OpenMP structured block So, I guess it is a problem of the Fortran front-end, which should detect this situation and reject the code. -- janus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Component|middle-end |fortran Keywords|ice-on-valid-code |ice-on-invalid-code http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42484