Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed no-range-check flag for gfortran #658

Merged
merged 5 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
set(CMAKE_C_FLAGS "-g ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "-ggdb -Wall")
set(CMAKE_Fortran_FLAGS "-g -fno-range-check -funroll-loops ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS "-g -funroll-loops ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS_DEBUG "-ggdb -Wall")
set(fortran_d_flags "-fdefault-real-8")
endif()
Expand Down
180 changes: 90 additions & 90 deletions src/g2getgb2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -667,96 +667,96 @@ end subroutine getgb2p
!> - 99 Request not found.
!>
!> @author Mark Iredell @date 1994-04-01
subroutine getgb2p2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, &
extract, k, gribm, leng, iret)
use grib_mod
implicit none

integer, intent(in) :: lugb, lugi, j, jdisc, jpdtn, jgdtn
integer, dimension(:) :: jids(*), jpdt(*), jgdt(*)
logical, intent(in) :: extract
integer, intent(out) :: k, iret, leng
character(len = 1), pointer, dimension(:) :: gribm

type(gribfield) :: gfld
integer :: irgi, irgs, jk, lpos, mskp, nlen, nmess, nnum, idxver
integer(kind = 8) :: msk1, msk2

character(len = 1), pointer, dimension(:) :: cbuf
parameter(msk1 = 32000, msk2 = 4000)

! Declare interfaces (required for cbuf pointer).
interface
subroutine getg2i2(lugi, cbuf, idxver, nlen, nnum, iret)
integer, intent(in) :: lugi
character(len=1), pointer, dimension(:) :: cbuf
integer, intent(out) :: idxver, nlen, nnum, iret
end subroutine getg2i2
subroutine getg2i2r(lugb, msk1, msk2, mnum, idxver, cbuf, &
nlen, nnum, nmess, iret)
integer, intent(in) :: lugb
integer (kind = 8), intent(in) :: msk1, msk2
integer, intent(in) :: mnum, idxver
character(len = 1), pointer, dimension(:) :: cbuf
integer, intent(out) :: nlen, nnum, nmess, iret
end subroutine getg2i2r
subroutine getgb2s2(cbuf, idxver, nlen, nnum, j, jdisc, jids, jpdtn, jpdt, jgdtn, &
jgdt, k, gfld, lpos, iret)
import gribfield
character(len = 1), intent(in) :: cbuf(nlen)
integer, intent(in) :: idxver, nlen, nnum, j, jdisc
integer, dimension(:) :: jids(*)
integer, intent(in) :: jpdtn
integer, dimension(:) :: jpdt(*)
integer, intent(in) :: jgdtn
integer, dimension(:) :: jgdt(*)
integer, intent(out) :: k
type(gribfield), intent(out) :: gfld
integer, intent(out) :: lpos, iret
end subroutine getgb2s2
subroutine getgb2rp2(lugb, idxver, cindex, extract, gribm, leng, iret)
integer, intent(in) :: lugb, idxver
character(len = 1), intent(in) :: cindex(*)
logical, intent(in) :: extract
character(len = 1), pointer, dimension(:) :: gribm
integer, intent(out) :: leng, iret
end subroutine getgb2rp2
end interface

! Initialize the index information in cbuf.
irgi = 0
if (lugi .gt. 0) then
call getg2i2(lugi, cbuf, idxver, nlen, nnum, irgi)
elseif (lugi .le. 0) then
mskp = 0
call getg2i2r(lugb, msk1, msk2, mskp, 2, cbuf, nlen, nnum, nmess, irgi)
endif
if (irgi .gt. 1) then
iret = 96
return
endif

! Find info from index and fill a grib_mod::gribfield variable.
call getgb2s2(cbuf, 2, nlen, nnum, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, &
jk, gfld, lpos, irgs)

if (irgs .ne. 0) then
iret = 99
call gf_free(gfld)
return
endif

! Extract grib message from file.
nullify(gribm)
call getgb2rp2(lugb, 2, cbuf(lpos:), .false., gribm, leng, iret)

k = jk

! Free cbuf memory allocated in getg2i/getg2ir().
if (associated(cbuf)) deallocate(cbuf)

call gf_free(gfld)
end subroutine getgb2p2
! subroutine getgb2p2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, &
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented this code out to eliminate a warning, but will be using it in a future PR later today or tomorrow...

! extract, k, gribm, leng, iret)
! use grib_mod
! implicit none

! integer, intent(in) :: lugb, lugi, j, jdisc, jpdtn, jgdtn
! integer, dimension(:) :: jids(*), jpdt(*), jgdt(*)
! logical, intent(in) :: extract
! integer, intent(out) :: k, iret, leng
! character(len = 1), pointer, dimension(:) :: gribm

! type(gribfield) :: gfld
! integer :: irgi, irgs, jk, lpos, mskp, nlen, nmess, nnum, idxver
! integer(kind = 8) :: msk1, msk2

! character(len = 1), pointer, dimension(:) :: cbuf
! parameter(msk1 = 32000, msk2 = 4000)

! ! Declare interfaces (required for cbuf pointer).
! interface
! subroutine getg2i2(lugi, cbuf, idxver, nlen, nnum, iret)
! integer, intent(in) :: lugi
! character(len=1), pointer, dimension(:) :: cbuf
! integer, intent(out) :: idxver, nlen, nnum, iret
! end subroutine getg2i2
! subroutine getg2i2r(lugb, msk1, msk2, mnum, idxver, cbuf, &
! nlen, nnum, nmess, iret)
! integer, intent(in) :: lugb
! integer (kind = 8), intent(in) :: msk1, msk2
! integer, intent(in) :: mnum, idxver
! character(len = 1), pointer, dimension(:) :: cbuf
! integer, intent(out) :: nlen, nnum, nmess, iret
! end subroutine getg2i2r
! subroutine getgb2s2(cbuf, idxver, nlen, nnum, j, jdisc, jids, jpdtn, jpdt, jgdtn, &
! jgdt, k, gfld, lpos, iret)
! import gribfield
! character(len = 1), intent(in) :: cbuf(nlen)
! integer, intent(in) :: idxver, nlen, nnum, j, jdisc
! integer, dimension(:) :: jids(*)
! integer, intent(in) :: jpdtn
! integer, dimension(:) :: jpdt(*)
! integer, intent(in) :: jgdtn
! integer, dimension(:) :: jgdt(*)
! integer, intent(out) :: k
! type(gribfield), intent(out) :: gfld
! integer, intent(out) :: lpos, iret
! end subroutine getgb2s2
! subroutine getgb2rp2(lugb, idxver, cindex, extract, gribm, leng, iret)
! integer, intent(in) :: lugb, idxver
! character(len = 1), intent(in) :: cindex(*)
! logical, intent(in) :: extract
! character(len = 1), pointer, dimension(:) :: gribm
! integer, intent(out) :: leng, iret
! end subroutine getgb2rp2
! end interface

! ! Initialize the index information in cbuf.
! irgi = 0
! if (lugi .gt. 0) then
! call getg2i2(lugi, cbuf, idxver, nlen, nnum, irgi)
! elseif (lugi .le. 0) then
! mskp = 0
! call getg2i2r(lugb, msk1, msk2, mskp, 2, cbuf, nlen, nnum, nmess, irgi)
! endif
! if (irgi .gt. 1) then
! iret = 96
! return
! endif

! ! Find info from index and fill a grib_mod::gribfield variable.
! call getgb2s2(cbuf, 2, nlen, nnum, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, &
! jk, gfld, lpos, irgs)

! if (irgs .ne. 0) then
! iret = 99
! call gf_free(gfld)
! return
! endif

! ! Extract grib message from file.
! nullify(gribm)
! call getgb2rp2(lugb, 2, cbuf(lpos:), .false., gribm, leng, iret)

! k = jk

! ! Free cbuf memory allocated in getg2i/getg2ir().
! if (associated(cbuf)) deallocate(cbuf)

! call gf_free(gfld)
! end subroutine getgb2p2

!> Read and unpack sections 6 and 7 from a GRIB2 message using a
!> version 1 index record.
Expand Down
Loading