LKedward / fhash

fpm package implementing a hash table with support for generic keys and values.
https://lkedward.github.io/fhash/
MIT License
38 stars 8 forks source link

Fix kind mismatch in calls to modulo #17

Closed jhaiduce closed 1 year ago

jhaiduce commented 1 year ago

Per the Fortran standard, arguments to modulo must have the same type and kind. The output of the size() function was being passed to modulo without specifying the kind; this results in a mismatch between the two arguments unless the default integer kind happens to be the same kind as output from the fhash_key_t%hash() function passed in the first argument to modulo. This produced an error in a standard compliant compiler (or when the compiler is set to check for standard compliance).

This PR addresses this by specifying the kind output by size as int64 to match the output from fhash_key_t%hash().

This fixes #16.

LKedward commented 1 year ago

Many thanks for identifying and providing a fix for this 👍. The Ci failure is unrelated and this all looks good to me so I'll now merge