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

Fix comparison between int and bool. #68

Open
wants to merge 1 commit into
base: feature/mtg2
Choose a base branch
from

Conversation

uhager
Copy link

@uhager uhager commented Mar 21, 2025

cray compiler fails with error if comparing LOGICAL and INTEGER.

@FussyDuck
Copy link

FussyDuck commented Mar 21, 2025

CLA assistant check
All committers have signed the CLA.

@uhager uhager changed the base branch from develop to feature/mtg2 March 21, 2025 15:57
@@ -725,7 +725,7 @@ PP_THREAD_SAFE FUNCTION GRIB2_SECTION4_MODEL_PRESET( THIS, &
CALL GRIB_IS_DEFINED( HANDLE, 'localDefinitionNumber', IS_DEFINED, STATUS=KRET )
PP_DEBUG_CRITICAL_COND_THROW( KRET.NE.GRIB_SUCCESS , ERRFLAG_UNABLE_TO_CHECK_IS_DEFINED )

IF( IS_DEFINED) THEN
IF( IS_DEFINED.GT.0 ) THEN
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing this—it was a real bug, and I appreciate the fix! While it’s true that some compilers are more lenient, that doesn’t justify leaving the issue unaddressed, so good catch here.

One minor suggestion: I’d recommend tweaking the check to use (IS_DEFINED .NE. 0) instead. It’s a cosmetic preference, but I think it reads a bit more clearly. That said, since the grib_is_defined function from the GRIB API only returns 0 or 1, your current implementation (IS_DEFINED .GT. 0) works perfectly fine either way.

Great work overall!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants