[flang-commits] [flang] [Flang] Don't create a hidden USE symbol for a same-name subprogram collision (PR #233665)
via flang-commits
flang-commits at lists.llvm.org
Wed Oct 21 06:48:27 PDT 2026
================
@@ -372,3 +372,38 @@ subroutine s_23_24
!ERROR: 'foo' is not a specific procedure
call ext(foo) ! definite error
end
+
+module m25
+ character(:), pointer :: TEST_COMPONENT_FOLLOWED_BY_REF
+ character(2), pointer :: c2
+ type t1
+ real :: x
+ end type
+ type t2
+ type(t1), pointer :: p
+ end type
+ type t3
+ character(:), allocatable :: a(:)
+ end type
+end module m25
+
+subroutine takes_real(x)
+ real, intent(in) :: x
+end subroutine takes_real
+
+subroutine test_char(x)
+ character(*), intent(in) :: x
+end subroutine test_char
+
+subroutine test_pointer_component_followed_by_component_ref(x)
+ use m25
+ type(t2) :: x
+ call takes_real(x%p%x)
+end subroutine test_pointer_component_followed_by_component_ref
+
+subroutine test_component_followed_by_ref(x)
+ !PORTABILITY: 'test_component_followed_by_ref' is use-associated into a subprogram of the same name [-Wuse-association-into-same-name-subprogram]
+ use m25
+ type(t3) :: x
+ call test_char(x%a(10))
+end subroutine test_component_followed_by_ref
----------------
keepyixiao wrote:
Thanks for the review , I Dropped the semantics-only test from resolve18.f90 and replaced it with a dedicated lowering test in flang/test/Lower/use-assoc-same-name-subprogram.f90.
The new test follows your suggested structure and covers deferred-length CHARACTER pointer and allocatable objects, as well as an INTEGER pointer case that verifies no descriptor address is incorrectly lowered. It runs with both bbc and %flang_fc1.
https://github.com/llvm/llvm-project/pull/233665
More information about the flang-commits
mailing list