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
103 stars 28 forks source link

fparser2 frontend does not recognise intrinsics with a single argument #526

Closed arporter closed 4 years ago

arporter commented 4 years ago

If I use master of PSyclone with master of fparser then processing the following code:

zccc = SQRT(MAX(zbbb * zbbb - 4._wp * rcpi * rLfus * ztmelts, 0._wp))

results in a CodeBlock as the argument to the SQRT() operation. I need to use master of fparser with NEMO because it has a bug fix for the number of arguments that CMPLX is permitted to take. I expect this bug is due to fparser/#170 which made all argument lists into lists, even when they only contain one item.

arporter commented 4 years ago

The problem is that there's no handler for Fortran2003.Actual_Arg_Spec_List nodes and therefore we automatically get a CodeBlock. @sergisiso, is there a handler already implemented for the case where we just want to ignore the current node and carry on down the parse tree? I've tried _ignore_handler but I'm not sure that does what I want?

arporter commented 4 years ago

Actually, I've worked out how to do what I want (just update the unary_op_handler to be aware of Actual_Arg_Spec_List nodes) so no need to worry.