[flang-commits] [flang] [flang] Permit unused USE association of subprogram name (PR #134009)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Wed Apr 2 06:33:04 PDT 2025


================
@@ -22,13 +22,17 @@ subroutine s(i)
 end module
 
 subroutine foo
-  !ERROR: Cannot use-associate 'foo'; it is already declared in this scope
+  !PORTABILITY: 'foo' is use-associated into a subprogram of the same name
   use m1
+  !ERROR: Reference to 'foo' is ambiguous
+  call foo
 end
 
 subroutine bar
-  !ERROR: Cannot use-associate 'bar'; it is already declared in this scope
+  !PORTABILITY: 'foo' is use-associated into a subprogram of the same name
   use m1, bar => foo
+  !ERROR: Reference to 'bar' is ambiguous
+  call bar
----------------
eugeneepshteyn wrote:

What about the following example? Should this now compile?
```
subroutine buz
  use m1

contains
  subroutine foo

  end subroutine foo
end
```

https://github.com/llvm/llvm-project/pull/134009


More information about the flang-commits mailing list