Skip to content

Commit

Permalink
chgres_cube: Remove "-fallow-argument-mismatch compile" flag (#865)
Browse files Browse the repository at this point in the history
The "-fallow-argument-mismatch" compiler flag is needed when building chgres_cube 
using GNU v10. Make minor adjustments to the source code to eliminate the need 
for this flag. 

Also, remove this flag from build of other programs that don't require it.

Fixes #471.
  • Loading branch information
GeorgeGayno-NOAA authored Oct 27, 2023
1 parent 41f7ca9 commit 325c32f
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 31 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -fbacktrace")
if(${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL 10)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-invalid-boz")
endif()
set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -ggdb -Wall -fcheck=all")
Expand Down
5 changes: 0 additions & 5 deletions sorc/chgres_cube.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -assume byterecl")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-0 -fdefault-real-8")

# Turn on this argument mismatch flag for gfortran10.
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch")
endif()
endif()

set(exe_name chgres_cube)
Expand Down
6 changes: 3 additions & 3 deletions sorc/chgres_cube.fd/atm_input_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ end subroutine read_input_atm_restart_file
!! @author George Gayno NCEP/EMC
subroutine read_input_atm_gaussian_netcdf_file(localpet)

use mpi
use mpi_f08

implicit none

Expand Down Expand Up @@ -1678,7 +1678,7 @@ end subroutine read_input_atm_gaussian_netcdf_file
!! @author George Gayno NCEP/EMC
subroutine read_input_atm_tiled_history_file(localpet)

use mpi
use mpi_f08

implicit none

Expand Down Expand Up @@ -1969,7 +1969,7 @@ end subroutine read_input_atm_tiled_history_file
!! @author George Gayno NCEP/EMC
subroutine read_input_atm_grib2_file(localpet)

use mpi
use mpi_f08
use grib_mod

use grib2_util, only : rh2spfh, rh2spfh_gfs, convert_omega
Expand Down
4 changes: 2 additions & 2 deletions sorc/chgres_cube.fd/atmosphere.F90
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ module atmosphere
!! @author George Gayno
subroutine atmosphere_driver(localpet)

use mpi
use mpi_f08

implicit none

Expand Down Expand Up @@ -1761,7 +1761,7 @@ END SUBROUTINE VINTG_WAM
!!
!! @author Mark Iredell @date 92-10-31
SUBROUTINE VINTG
use mpi
use mpi_f08

IMPLICIT NONE

Expand Down
2 changes: 1 addition & 1 deletion sorc/chgres_cube.fd/chgres.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
!! @return 0 for success, error code otherwise.
program chgres

use mpi
use mpi_f08
use esmf

use atmosphere, only : atmosphere_driver
Expand Down
2 changes: 1 addition & 1 deletion sorc/chgres_cube.fd/msis2.1.fd/msis_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ end subroutine initparmspace
!==================================================================================================
subroutine loadparmset(name,iun)

use mpi
use mpi_f08

use msis_constants, only : maxnbf, csfxmod

Expand Down
2 changes: 1 addition & 1 deletion sorc/chgres_cube.fd/search_util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module search_util
!! @author George Gayno NCEP/EMC
subroutine search (field, mask, idim, jdim, tile, field_num, latitude, terrain_land, soilt_climo)

use mpi
use mpi_f08
use esmf

implicit none
Expand Down
2 changes: 1 addition & 1 deletion sorc/chgres_cube.fd/sfc_input_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ end subroutine read_input_sfc_netcdf_file
!! @author Larissa Reames
subroutine read_input_sfc_grib2_file(localpet)

use mpi
use mpi_f08
use grib_mod
use program_setup, only : vgtyp_from_climo, sotyp_from_climo
use model_grid, only : input_grid_type
Expand Down
2 changes: 1 addition & 1 deletion sorc/chgres_cube.fd/surface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ end subroutine surface_driver
!! @author George Gayno NOAA/EMC
subroutine interp(localpet)

use mpi
use mpi_f08
use esmf

use sfc_input_data, only : canopy_mc_input_grid, &
Expand Down
4 changes: 2 additions & 2 deletions sorc/chgres_cube.fd/utils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module utilities
!! @param[in] rc error status code
subroutine error_handler(string, rc)

use mpi
use mpi_f08

implicit none

Expand All @@ -33,7 +33,7 @@ end subroutine error_handler
!! @param[in] string error message
subroutine netcdf_err( err, string )

use mpi
use mpi_f08
use netcdf

implicit none
Expand Down
5 changes: 0 additions & 5 deletions sorc/cpld_gridgen.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -assume byterecl")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-0 -fdefault-real-8")

# Turn on this argument mismatch flag for gfortran10.
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch")
endif()
endif()

set(exe_name cpld_gridgen)
Expand Down
3 changes: 3 additions & 0 deletions sorc/gblevents.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8")
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch")
endif()
set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
endif()

Expand Down
3 changes: 0 additions & 3 deletions sorc/lsm_routines.fd/noah.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fconvert=big-endian")
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch")
endif()
endif()

set(lib_name noah_lsm_routines)
Expand Down
2 changes: 1 addition & 1 deletion sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fconvert=big-endian -fno-range-check")
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-invalid-boz")
endif()
endif()
if(ip_VERSION GREATER_EQUAL 4.0.0)
Expand Down
2 changes: 1 addition & 1 deletion sorc/orog_mask_tools.fd/orog_gsl.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fno-range-check")
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-invalid-boz")
endif()
endif()

Expand Down
3 changes: 0 additions & 3 deletions sorc/weight_gen.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -i4 -convert big_endian")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8")
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch")
endif()
endif()

set(exe_name weight_gen)
Expand Down

0 comments on commit 325c32f

Please sign in to comment.