dbartilson / fh_table

Modern Fortran hash functions and hash tables
MIT License
5 stars 0 forks source link

Does not compile with gfortran-10 #1

Closed dmr-dj closed 3 years ago

dmr-dj commented 3 years ago

Dear dbartilson,

Using gfortran-10 (GNU Fortran (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0, in my case) , fh_table does not compile and yield the following error:

hash_table_module.f90:30:25: 30 | integer :: deleted = Z'8000000' | 1 Error: BOZ literal constant at (1) is neither a data-stmt-constant nor an actual argument to INT, REAL, DBLE, or CMPLX intrinsic >function [see ‘-fno-allow-invalid-boz’] hash_table_module.f90:31:25:

31 | integer :: empty = Z'7FFFFFF' | 1 Error: BOZ literal constant at (1) is neither a data-stmt-constant nor an actual argument to INT, REAL, DBLE, or CMPLX intrinsic >function [see ‘-fno-allow-invalid-boz’]

I suspect this is due to the change of default behaviour, '-fno-allow-invalid-boz' being the default in gfortran-10. The direct initialization of an integer variable with a BOZ literal constant being an extension to the standard, I believe an appropriate fix would be to change the line 30 & 31 of hash_table_module.f90 as:

integer :: deleted = int(Z'8000000') integer :: empty = int(Z'7FFFFFF')

This would be standard conformant and is accepted by both gfortran-9 and gfortran-10. Best wishes, dmr

dbartilson commented 3 years ago

Thanks for pointing out the issue. Your proposed fix was implemented.