NCAR / icar

The Intermediate Complexity Atmospheric Research model (ICAR)
MIT License
72 stars 53 forks source link

Bugfix: Cray logical derived type member values #173

Closed scrasmussen closed 9 months ago

scrasmussen commented 9 months ago

TYPE: bug fix

KEYWORDS: derived types, logical types, hack

SOURCE: Soren Rasmussen, NCAR

DESCRIPTION OF CHANGES: If using the Cray compiler, turn off optimization when compiling the options_obj.f90 file.

TESTS CONDUCTED: Add the following lines to line 1930 of options_obj.f90.

        print*, "use_simple_sw, options%rad_options%use_simple_sw, rad_options%use_simple_sw"
        print*, use_simple_sw, options%rad_options%use_simple_sw, rad_options%use_simple_sw
stop "debugging"

NOTE: The -eo compiler option lists all the optimization flags. Since -O0 works and -O1 does not, I could test each flag that is different individually to find which one is breaking this test. Might be worth it in case the optimization would break things somewhere else. I had previously tried to create a simple reproducer but have been unsuccessful since this issue probably has to do with the complexity of derived types/modules/submodules being used. But it might be worth it to try to create one to add to the CTests (this is a branch that has CTests but is waiting for good ones before it becomes a PR).

Checklist

Merging the PR depends on following checklist being completed. Add X between each of the square brackets if they are completed in the PR itself. If a bullet is not relevant to you, please comment on why below the bullet.