HOME
| OPENMP API Specification: "Version 5.2 -- GIT rev 95b2e3a44"

4.3.1  OpenMP Context-Specific Structured Blocks

An OpenMP context-specific structured block consists of statements that conform to specific restrictions so that OpenMP can treat them as a structured block or a structured block sequence. The restrictions depend on the context in which the context-specific structured block can be used.

4.3.1.1 OpenMP Allocator Structured Blocks
An OpenMP allocator structured block consists of allocate-stmt, where allocate-stmt is a Fortran ALLOCATE statement. Allocator structured blocks are considered strictly structured blocks for the purpose of the allocators construct.

Cross References

4.3.1.2 OpenMP Function Dispatch Structured Blocks

An OpenMP function dispatch structured block is a context-specific structured block that identifies the location of a function dispatch.

A function dispatch structured block is an expression statement with one of the following forms:
 
lvalue-expression = target-call ( [expression-list] );  

or  

 
target-call ( [expression-list] );  
A function dispatch structured block is an expression statement with one of the following forms:
 
expression = target-call ( [arguments] )  

or  

 
CALL target-call [ ( [arguments] )]  

For purposes of the dispatch construct, the expression statement is considered a strictly structured block.

Restrictions

Restrictions to the function dispatch structured blocks are as follows:

The target-call expression can only be a direct call.
target-call must be a procedure name. target-call must not be a procedure pointer.

Cross References

4.3.1.3 OpenMP Atomic Structured Blocks

An OpenMP atomic structured block is a context-specific structured block that can appear in an atomic construct. The form of an atomic structured block depends on the atomic semantics that the directive enforces.

In the following definitions:

x, r (result), and v (as applicable) are lvalue expressions with scalar type. e (expected) is an expression with scalar type, d (desired) is an expression with scalar type. e and v may refer to, or access, the same storage location. expr is an expression with scalar type. The order operation, ordop, is one of <, or >. binop is one of +, *, -, /, &, ^, |, <<, or >>. == comparisons are performed by comparing the value representation of operand values for equality after the usual arithmetic conversions; if the object representation does not have any padding bits, the comparison is performed as if with memcmp. For forms that allow multiple occurrences of x, the number of times that x is evaluated is unspecified but will be at least one. For forms that allow multiple occurrences of expr, the number of times that expr is evaluated is unspecified but will be at least one. The number of times that r is evaluated is unspecified but will be at least one. Whether d is evaluated if x == e evaluates to false is unspecified.
x, v, d and e (as applicable) are scalar variables of intrinsic type. expr is a scalar expression. expr-list is a comma-separated, non-empty list of scalar expressions. intrinsic-procedure-name is one of MAX, MIN, IAND, IOR, or IEOR. operator is one of +, *, -, /, .AND., .OR., .EQV., or .NEQV.. equalop is ==, .EQ., or .EQV.. == or .EQ. comparisons are performed by comparing the physical representation of operand values for equality after the usual conversions as described in the base language, while ignoring padding bits, if any. .EQV. comparisons are performed as described in the base language. For forms that allow multiple occurrences of x, the number of times that x is evaluated is unspecified but will be at least one. For forms that allow multiple occurrences of expr, the number of times that expr is evaluated is unspecified but will be at least one. The number of times that r is evaluated is unspecified but will be at least one. Whether d is evaluated if x equalop e evaluates to false is unspecified.

A read-atomic structured block can be specified for atomic directives that enforce atomic read semantics but not capture semantics.

A read-atomic structured block is read-expr-stmt, a read expression statement that has the following form:
 
v = x;  
A read-atomic structured block is read-statement, a read statement that has the following form:
 
v = x  

A write-atomic structured block can be specified for atomic directives that enforce atomic write semantics but not capture semantics.

A write-atomic structured block is write-expr-stmt, a write expression statement that has the following form:
 
x = expr;  
A write-atomic structured block is write-statement, a write statement that has the following form:
 
x = expr  

An update-atomic structured block can be specified for atomic directives that enforce atomic update semantics but not capture semantics.

An update-atomic structured block is update-expr-stmt, an update expression statement that has one of the following forms:
 
x++; 
x--; 
++x
--x
x binopexpr
x = x binop expr
x = expr binop x;  
An update-atomic structured block is update-statement, an update statement that has one of the following forms:
 
x = x operator expr 
x = expr operator x 
x = intrinsic-procedure-name (xexpr-list
x = intrinsic-procedure-name (expr-listx)  

A conditional-update-atomic structured block can be specified for atomic directives that enforce atomic conditional update semantics but not capture semantics.

A conditional-update-atomic structured block is either cond-expr-stmt, a conditional expression statement that has one of the following forms:
 
x = expr ordop x ? expr : x
x = x ordop expr ? expr : x
x = x == e ? d : x;  

or cond-update-stmt, a conditional update statement that has one of the following forms:  

 
if(expr ordop x) { x = expr; } 
if(x ordop expr) { x = expr; } 
if(x == e) { x = d; }  
A conditional-update-atomic structured block is conditional-update-statement, a conditional update statement that has one of the following forms:
 
if (x equalop e) then 
  x = d 
end if  

or  

 
if (x equalop ex = d  

read-atomic, write-atomic, update-atomic, and conditional-update-atomic structured blocks are considered strictly structured blocks for the purpose of the atomic construct.

A capture-atomic structured block can be specified for atomic directives that enforce capture semantics. They are further categorized as write-capture-atomic, update-capture-atomic, and conditional-update-capture-atomic structured blocks, which can be specified for atomic directives that enforce write, update or conditional update atomic semantics in addition to capture semantics.

A capture-atomic structured block is capture-stmt, a capture statement that has one of the following forms:
 
v = expr-stmt 
v = xexpr-stmt } 
expr-stmt v = x; }  

If expr-stmt is write-expr-stmt or expr-stmt is update-expr-stmt as specified above then it is an update-capture-atomic structured block. If expr-stmt is cond-expr-stmt as specified above then it is a conditional-update-capture-atomic structured block. In addition, a conditional-update-capture-atomic structured block can have one of the following forms:  

 
v = xcond-update-stmt } 
cond-update-stmt v = x;  } 
if(x == e) { x = d; } else { v = x; } 
r = x == e; if(r) { x = d; } } 
r = x == e; if(r) { x = d; } else { v = x; } }  
A capture-atomic structured block has one of the following forms:
 
statement 
capture-statement  

or  

 
capture-statement 
statement  

where capture-statement has the following form:  

 
v = x  

If statement is write-statement as specified above then it is a write-capture-atomic structured block. If statement is update-statement as specified above then it is an update-capture-atomic structured block. If statement is conditional-update-statement as specified above then it is a conditional-update-capture-atomic structured block. In addition, for a conditional-update-capture-atomic structured block, statement can have the following form:  

 
x = expr  

In addition, a conditional-update-capture-atomic structured block can have the following form:  

 
if (x equalop e) then 
  x = d 
else 
  v = x 
end if  

All capture-atomic structured blocks are considered loosely structured blocks for the purpose of the atomic construct.

Restrictions

Restrictions to OpenMP atomic structured blocks are as follows:

In forms where e is assigned it must be an lvalue. r must be of integral type. During the execution of an atomic region, multiple syntactic occurrences of x must designate the same storage location. During the execution of an atomic region, multiple syntactic occurrences of r must designate the same storage location. During the execution of an atomic region, multiple syntactic occurrences of expr must evaluate to the same value. None of v, x, r, d and expr (as applicable) may access the storage location designated by any other symbol in the list. In forms that capture the original value of x in v, v and e may not refer to, or access, the same storage location. binop, binop=, ordop, ==, ++, and -- are not overloaded operators. The expression x binop expr must be numerically equivalent to x binop (expr). This requirement is satisfied if the operators in expr have precedence greater than binop, or by using parentheses around expr or subexpressions of expr. The expression expr binop x must be numerically equivalent to (expr) binop x. This requirement is satisfied if the operators in expr have precedence equal to or greater than binop, or by using parentheses around expr or subexpressions of expr. The expression x ordop expr must be numerically equivalent to x ordop (expr). This requirement is satisfied if the operators in expr have precedence greater than ordop, or by using parentheses around expr or subexpressions of expr. The expression expr ordop x must be numerically equivalent to (expr) ordop x. This requirement is satisfied if the operators in expr have precedence equal to or greater than ordop, or by using parentheses around expr or subexpressions of expr. The expression x == e must be numerically equivalent to x == (e). This requirement is satisfied if the operators in e have precedence equal to or greater than ==, or by using parentheses around e or subexpressions of e.
x must not have the ALLOCATABLE attribute. During the execution of an atomic region, multiple syntactic occurrences of x must designate the same storage location. During the execution of an atomic region, multiple syntactic occurrences of r must designate the same storage location. During the execution of an atomic region, multiple syntactic occurrences of expr must evaluate to the same value. None of v, expr, and expr-list (as applicable) may access the same storage location as x. None of x, expr, and expr-list (as applicable) may access the same storage location as v. In forms that capture the original value of x in v, v may not access the same storage location as e. If intrinsic-procedure-name refers to IAND, IOR, or IEOR, exactly one expression must appear in expr-list. The expression x operator expr must be, depending on its type, either mathematically or logically equivalent to x operator (expr). This requirement is satisfied if the operators in expr have precedence greater than operator, or by using parentheses around expr or subexpressions of expr. The expression expr operator x must be, depending on its type, either mathematically or logically equivalent to (expr) operator x. This requirement is satisfied if the operators in expr have precedence equal to or greater than operator, or by using parentheses around expr or subexpressions of expr. The expression x equalop e must be, depending on its type, either mathematically or logically equivalent to x equalop (e). This requirement is satisfied if the operators in e have precedence equal to or greater than equalop, or by using parentheses around e or subexpressions of e. intrinsic-procedure-name must refer to the intrinsic procedure name and not to other program entities. operator must refer to the intrinsic operator and not to a user-defined operator. All assignments must be intrinsic assignments.

Cross References