I have run accross random results using a BLOCK, END BLOCK contstruct. My application was multi-threaded. When I move the local declarations into the parent procedure and remove the BLOCK construct the results become repeatable.
I am using implied AUTOMATIC for the project via /Qopenmp.
The help file does not mention this limitation of your implementation. Is it a bug or intentional ?
Using Visual Fortran Compiler XE 188.8.131.520.
A BLOCK construct cannot appear inside a structured block of an OpenMP* directive.
I do not know why there is this restriction.
It appears perhaps F2008 Standard related but I’m not finding supportive details so I’ll inquire w/Development. I expect it relates to this error that will be issued when the restriction is violated:
error #7936: This statement or directive is not permitted within the block of an OpenMP* WORKSHARE or OpenMP* PARALLEL WORKSHARE directive.
Here's some clarification. Correction, it is not F2008 Standard related rather it relates to a lack of meaning in terms of the OpenMP API.
The Developers indicate support could be implemented in the future. I’m told, when the OpenMP API documents what it means to have a BLOCK inside an OMP directive. It’s a question of variable scoping – a local inside the BLOCK inside an OMP block couldn’t appear on the SHARED etc lists of the OMP directive – they’re not visible in that scope. If that just means all BLOCK locals inside OMP are PRIVATE, end of discussion, then that’s a simple definition.
You might have success in cutting the block out of the code and replacing it with:
and make MyBlock a contains subroutine.
This will place the code out of line, but it may permit you to do what you want.
>>So the BLOCK construct should work OK in a recursive routine provided the routine is not inside an openMP construct ?
Note, the contains subroutine will permit the subroutine to see the containing procedures variables without passing them as dummy's
I think there have been a number of bugs with block contructs, possibly including: