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

horiz_interp_type_eq does not work with gnu #1557

Open
uramirez8707 opened this issue Jul 23, 2024 · 0 comments · May be fixed by #1584
Open

horiz_interp_type_eq does not work with gnu #1557

uramirez8707 opened this issue Jul 23, 2024 · 0 comments · May be fixed by #1584
Labels
bug Issue/PR that reports or fixes a given discovered bug help wanted

Comments

@uramirez8707
Copy link
Contributor

Describe the bug
horiz_interp_type_eq does not work with gnu

This is because some of the members of the horiz_interp_type are allocatables

integer, dimension(:,:), allocatable :: ilon !< indices for conservative scheme
integer, dimension(:,:), allocatable :: jlat !< indices for conservative scheme
!! wti ist used for derivative "weights" in bicubic
integer, dimension(:,:,:), allocatable :: i_lon !< indices for bilinear interpolation
!! and spherical regrid
integer, dimension(:,:,:), allocatable :: j_lat !< indices for bilinear interpolation
!! and spherical regrid
logical, dimension(:,:), allocatable :: found_neighbors !< indicate whether destination grid
!! has some source grid around it.
integer, dimension(:,:), allocatable :: num_found

But some of the members are never allocatated, depending on the interpolation method. For example, ilon and jlat are never allocated if using bilinear.
https://github.com/NOAA-GFDL/FMS/blob/main/horiz_interp/include/horiz_interp_bilinear.inc

This causes error with GNU like

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

To Reproduce
The changes here can reproduce the issue
uramirez8707@05c78b4

Expected behavior
The subroutine should check if a variable is allocatable before attempting to copy it

System Environment
Describe the system environment, include:
I saw this using gcc/13.2.0 on the amd box, but it also happens in the CI

Additional context
Discover this while debugging #1556

@uramirez8707 uramirez8707 added help wanted bug Issue/PR that reports or fixes a given discovered bug labels Aug 5, 2024
@rem1776 rem1776 linked a pull request Sep 3, 2024 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue/PR that reports or fixes a given discovered bug help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant