-
Notifications
You must be signed in to change notification settings - Fork 15
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
compilation fails with gfortran 12.1.0 #23
Comments
Just to add that gfortran 10.4.0 and 11.3.0 are also affected by this. gfortran 9.5.0 is ok. |
I've found a fix - but it is quite tedious to implement. So before proceeding I have the following questions:
The fix is to explicit put a reshape in for all 2d arrays when they are part of a type. There is more than 200 places to fix. So if the file is auto generated the issue should be fixed during the generation. If not auto generated some clever search and replace might do the most of the work. |
Since this problem did not occur with any gfortran version from before May 2022, nor with ifort, it looked like it could be a gfortran bug. However, it is not: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106684. Thus the code would need a fix. Use of reshape as mentioned above is an option, and the bugzilla thread also mentions an alternative at the very bottom. |
versions of gfortran (10.4.0, 11.3.0 and 12.1.0) fails For a discussion of the Fortran issue see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106684 For a discussion on how it is resolved see: TEOS-10#23
The pull request has been extended to include a Github Actions file - that - upon a git push - will compile GSW-Fortran and run the test programs gsw_check_functions.x and gsw_poly_check.x on the Github infrastructure. Results can be inspected here - https://github.com/TEOS-10/GSW-Fortran/actions. At present gfortran version 9, 10 and 11 are checked using Ubuntu. |
With gfortran 12.1.0 a large number of errors like one below are reported. Compilation thus does not succeed.
.../GSW-Fortran/modules/gsw_mod_check_data.f90:781:30:
781 | "C_from_SP", 6.1638e-10_r8, (/ &
| 1
Error: The rank of the element in the structure constructor at (1) does not match that of the component (1/2)
It seems that this gfortran release does not like 1D data to be assigned to a 2D array. This is not a problem for earlier gfortran releases, nor for intel fortran. I'm not sure whether gfortran 12 is overly strict in its interpretation of the Fortran standards here, or the others are too lenient...
The text was updated successfully, but these errors were encountered: