stfc / PSyclone

Domain-specific compiler and code transformation system for Finite Difference/Volume/Element Earth-system models in Fortran
BSD 3-Clause "New" or "Revised" License
107 stars 29 forks source link

2630 some support for data statement #2650

Closed hiker closed 3 months ago

hiker commented 4 months ago

Adds some support for Data statements - they are turned into UnsupportedFortranTypes, but this means that the rest of files containing data statements are properly handled now.

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.86%. Comparing base (93083d8) to head (42eec07).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2650 +/- ## ======================================= Coverage 99.86% 99.86% ======================================= Files 352 353 +1 Lines 48712 48806 +94 ======================================= + Hits 48647 48741 +94 Misses 65 65 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

hiker commented 4 months ago

I've also updated the dev guide (thanks for pointing this out in #2658)

hiker commented 3 months ago

Thanks for this Joerg, I think it's a good first step. I am wondering whether we should take note of: ... i.e. that any symbols initialised in a DATA statement effectively have the SAVE attribute. This is true for both Fortran2003 and 2008. I'm not sure about earlier standards. I'll check integration tests next time. Appropriate doc has been updated.

OK, I have added this, including support for nested do loops, and derived statements, and added tests based on the F90 standard. You know fparser better than me, I hope I got the possible node type for variables correct (there seems to be a bit of a difference between fparser and the standard:

R526:  data-stmt-object is variable
                        or data-implied-do

I assume the variable is skipped? So I hope I capture all possible ways a variable might be specified. Similar for:

R528 data-i-do-object is array-element
                      or scalar-structure-component
                      or data-implied-do

I don't see array-element or scalar-structure component, so I search for PartRef.

I've triggered CI.

hiker commented 3 months ago

All done, CI triggered and it finished successfully.