Skip to content

Commit 60bc7b0

Browse files
committed
Fixes for ifx compiler - zeroing out nan and fillvalues requires ensuring neither have nans first
1 parent 9925df8 commit 60bc7b0

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

src/dynamics/se/dyn_comp.F90

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,18 @@ subroutine read_dyn_field_2d(fieldname, fh, dimname, buffer)
22172217
! to NaN. In that case infld can return NaNs where the element GLL points
22182218
! are not "unique columns"
22192219
! Set NaNs or fillvalue points to zero
2220-
where (isnan(buffer) .or. (buffer==fillvalue)) buffer = 0.0_r8
2220+
where (isnan(buffer))
2221+
! check for NaN first, as comparing NaN to fillvalue raises floating invalid.
2222+
buffer = 0.0_r8
2223+
end where
2224+
2225+
if (.not. isnan(fillvalue)) then
2226+
! only compare against fillvalue if fillvalue is not NaN, otherwise the comparison
2227+
! will raise floating invalid.
2228+
where (buffer == fillvalue)
2229+
buffer = 0.0_r8
2230+
end where
2231+
end if
22212232

22222233
end subroutine read_dyn_field_2d
22232234

@@ -2247,7 +2258,18 @@ subroutine read_dyn_field_3d(fieldname, fh, dimname, buffer)
22472258
! to NaN. In that case infld can return NaNs where the element GLL points
22482259
! are not "unique columns"
22492260
! Set NaNs or fillvalue points to zero
2250-
where (isnan(buffer) .or. (buffer == fillvalue)) buffer = 0.0_r8
2261+
where (isnan(buffer))
2262+
! check for NaN first, as comparing NaN to fillvalue raises floating invalid.
2263+
buffer = 0.0_r8
2264+
end where
2265+
2266+
if (.not. isnan(fillvalue)) then
2267+
! only compare against fillvalue if fillvalue is not NaN, otherwise the comparison
2268+
! will raise floating invalid.
2269+
where (buffer == fillvalue)
2270+
buffer = 0.0_r8
2271+
end where
2272+
end if
22512273

22522274
end subroutine read_dyn_field_3d
22532275

0 commit comments

Comments
 (0)