0ab5559 to
f65ebfd
Compare
|
@perazz, can you please review this PR? |
There was a problem hiding this comment.
Please sync this branch with main
f65ebfd to
4c98a28
Compare
|
Rebased my branch with main |
This PR fixes an instance of invalid Fortran code where an allocatable character component is referenced while unallocated during string concatenation. For eg.
target%compile_flags = target%compile_flags // ' ' // compile_flagsIf target%compile_flags is unallocated, this code is not standard-conforming. Although automatic allocation on assignment is permitted for allocatable variables on the left-hand side, the right-hand side expression must be fully evaluated before allocation occurs.
Referencing an unallocated allocatable variable during expression evaluation is prohibited by the Fortran standard:
5.4.10 p2: “An unallocated allocatable variable shall not be referenced or defined.”
10.2.1.1: the right-hand side of an intrinsic assignment is evaluated prior to any automatic allocation.
9.7.1.3: automatic allocation applies only after expression evaluation.
10.1.5.3: the // operator requires both operands to be referenced to obtain their values.