Skip to content

Inlining adds (:,:) in lbound etc #3248

@hiker

Description

@hiker

When inlining, a LBOUND(current, dim=1) expression (given explicit in the code) is turned into LBOUND(current(:,:), dim=1). The latter is wrong if current does not have '1' as lower bound (since the latter expression will always return 1, even if current is e.g. (0:11, 0:11)).

When additional lbound statements added by PSyclone, they work as expected, e.g.:

 neighbours(i - 1 + LBOUND(neighbours, dim=1),j - 1 + LBOUND(neighbours, dim=2)) = current(i - 1 - 1 + LBOUND(current, &
&dim=1),j - 1 - 1 + LBOUND(current, dim=2)) + current(i - 1 + LBOUND(current, dim=1),j - 1 - 1 + LBOUND(current, dim=2)) + &

For now, an example is here:
https://github.com/stfc/PSyclone/tree/1623_add_training/tutorial/training/transformation/3.4-tiling/solution
Just run make.

In the FortranWriter, I see that the statements inserted by PSyclone (I assume by the inline transformation?) has a Reference as parameter, while the lbound from the inlined function has an ArrayReference (with a Range, which is then turned into (:,:).

Not sure exactly what is wrong tbh.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions