HOME
| OPENMP API Specification: Version 5.1 November 2020

2.5.4  error Directive

Summary The error directive instructs the compiler or runtime to display a message and to perform an error action. The error directive is a utility directive unless the at clause is specified with the execution value, in which case the error directive is a stand-alone directive.

Syntax

SVG-Viewer needed.

The syntax of the error directive is as follows:  

 
#pragma omp error [clause[ [,] clause] ... ] new-line  

where clause is one of the following:  

 
at(compilation | execution) 
severity(fatal | warning) 
message(msg-string)  

where msg-string is a string of const char * type.

SVG-Viewer needed.

SVG-Viewer needed.

The syntax of the error directive is as follows:  

 
!$omp error [clause[ [,] clause] ... ]  

where clause is one of the following:  

 
at(compilation | execution) 
severity(fatal | warning) 
message(msg-string)  

where msg-string is a character string of character(len=*) type

SVG-Viewer needed.

Description The error directive performs an error action. The error action includes the display of an implementation defined message. The severity clause determines whether the error action includes anything other than the message display.

The at clause determines when the implementation performs the error action. When the at clause specifies compilation, the error action is performed during compilation if the error directive appears in a declarative context or in an executable context that is reachable at runtime. When the at clause specifies compilation and the error directive appears in an executable context that is not reachable at runtime, the error action may or may not be performed. When the at clause specifies execution, the error action is performed during program execution when a thread encounters the directive. If the at clause is not specified then the error directive behaves as if the at clause specifies compilation.

The severity clause determines the action that the implementation performs. When the severity clause specifies warning, the implementation takes no action besides displaying the message. When the severity clause specifies fatal and the at clause specifies compile then the message is displayed and compilation of the current compilation unit is aborted. When the severity clause specifies fatal and the at clause specifies execution then the message is displayed and program execution is aborted. If no severity clause is specified then the error directive behaves as if the severity clause specifies fatal.

If the message clause is specified then msg-string is included in the implementation defined message.

Execution Model Events The runtime-error event occurs when a thread encounters an error directive for which the at clause specifies execution.

Tool Callbacks A thread dispatches a registered ompt_callback_error callback for each occurrence of a runtime-error event in the context of the encountering task. This callback has the type signature ompt_callback_error_t.

Restrictions Restrictions to the error directive are as follows:

Cross References