PSyclone: PSyclone reordering symbol table during output resulting in compiler error

When accessing (at least) one file in Socrates PSyclone changes the order of variable declaration, which is resulting in compiler error due to undefined variable.

The file in question is gas_list_pcf.f90, at some point there is a variable defined as: INTEGER, PRIVATE :: i

later in the file during the various reshape calls, this i variable is used.

IN the file output by PSyclone, the outputs are reordered such that some accesses to i are used before its definition:

&public :: threshold_wavelength = RESHAPE([REAL(KIND = RealK) :: 246.0E-09_RealK, 242.0E-09_RealK, 175.0E-09_RealK, &
&134.0E-09_RealK, 129.0E-09_RealK, (0.0_RealK, i = 1, npd_products - 5), 227.5E-09_RealK, 167.1E-09_RealK, 128.6E-09_RealK, &
&108.2E-09_RealK, 89.922E-09_RealK, 65.026E-09_RealK, 63.693E-09_RealK, 54.655E-09_RealK, (0.0_RealK, i = 1, npd_products - 8), &
..... rest of this definition
... string array definition
integer, private :: i

This happens in some other files too, e.g. refract_re_ccf.f90

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 17 (3 by maintainers)

Most upvoted comments

Victoria (MO) has hit a related problem with our re-ordering of declarations. NEMOVAR has code that defines a type and declares an abstract interface that uses that type. Unfortunately, when we re-generate the declarations, we put the type declaration after the interface declaration and the compiler is unhappy. (Note that the type declaration is of UnknownFortranType because it contains PROCEDURE elements.) I think the only solution to this is to examine the parse trees of the two declarations and check for dependencies?