Skip to content

[flang] Spurious error with ASSOCIATE in a PURE procedure #131356

@kcooley-cvd

Description

@kcooley-cvd

When given the following code:

MODULE test_m
   REAL :: module_var
CONTAINS
   PURE SUBROUTINE test()
      ASSOCIATE(var => module_var)
      END ASSOCIATE
   END SUBROUTINE test
END MODULE test_m

Flang wrongly announces an error:

./test.f90:14:17: error: A pure subprogram may not have a variable with the SAVE attribute
        ASSOCIATE(var => module_var)
                  ^^^

But test is a valid PURE subroutine since var is not assigned to. Version information:

flang version 20.1.0 (https://github.com/llvm/llvm-project.git 24a30daaa559829ad079f2ff7f73eb4e18095f88)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions