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

Julian library causes runs to fail when the code is built with gfortran and the -O0 flag #19

Open
jimc101 opened this issue Mar 15, 2024 · 0 comments

Comments

@jimc101
Copy link

jimc101 commented Mar 15, 2024

The error occurs in the function READ_DATETIME in mod_time.F. It stems from the following call to the Julian library:

statl = FJul_ParseDT(timestr, frmt, dutc, secs)

statl is declared to be of type logical. I believe the problem arises with how the Julian library handles boolean types, and differences in how gfortran and ifort internally represent boolean values. In the Julian library, macros are used to redefine True and False using the values -1 and 0 respectively. This matches the way ifort internally represents boolean values. It doesn't match the way gfortran internally represents boolean values, and I believe that is the source of the problem.

The problem "goes away" when the model is built using gfortran and the -O2 or -O3 flags. I am not sure why this is.

To fix the problem, users can either manually change the values of FTRUE and FFALSE in the Julian library file cfortran.h to 1 and 0 respectively, or a condition that tests when when the model is being built with gfortran could be added, and different flags set when this is the case. A condition already exists for Apple computers.

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

No branches or pull requests

1 participant