Skip to content

Make comparison operators pure functions

Sergey Kosukhin requested to merge purify-comparison into master

The comparison operators should be PURE functions. Otherwise, the compiler is not sure whether it can apply the short-circuit evaluation of boolean expressions:

iconoce.f90:281:65:

  281 |     IF (isCurrentEventActive(checkpointEvent, current_date) .AND. start_date /= current_date) THEN
      |                                                                 1
Error: Impure function ‘datetime_ne’ at (1) might not be evaluated [-Werror=function-elimination]

Unfortunately, older versions of NAG do not consider C_LOC as a PURE function. Hence the workaround.

Edited by Sergey Kosukhin

Merge request reports