Issue 61449
Summary [flang] compilation failed with "The left-hand side of a pointer assignment is not definable"
Labels new issue
Assignees
Reporter k-arrows
    Test code:
```console
$ cat map_any_type1.f90
module map_any_type
  implicit none

  type :: list_item
    character(:), allocatable :: key
    type(list_item), pointer :: next => null(), prev => null()
  end type list_item

 type, public :: map_any
    type(list_item), pointer :: first => null()
  end type map_any

contains

  subroutine append_list_item (this, item)
    class(map_any), intent(inout) :: this
    type(list_item), pointer, intent(in) :: item
 type(list_item), pointer :: tail
    if (associated(this%first)) then
 tail => this%first%prev
      tail%next => item
      item%prev => tail
      this%first%prev => item
    else
      item%prev => item
      this%first => item
    end if
  end subroutine append_list_item

end module map_any_type
```

Compilation result:
```console
$ gfortran -c map_any_type1.f90
$ flang-new -c map_any_type1.f90
error: Semantic errors in map_any_type1.f90
./map_any_type1.f90:22:7: error: The left-hand side of a pointer assignment is not definable
        item%prev => tail
 ^^^^^^^^^^^^^^^^^
./map_any_type1.f90:22:7: because: 'item' is an INTENT(IN) dummy argument
        item%prev => tail
 ^^^^^^^^^^^^^^^^^
./map_any_type1.f90:17:45: Declaration of 'item'
 type(list_item), pointer, intent(in) :: item
 ^^^^
./map_any_type1.f90:25:7: error: The left-hand side of a pointer assignment is not definable
        item%prev => item
 ^^^^^^^^^^^^^^^^^
./map_any_type1.f90:25:7: because: 'item' is an INTENT(IN) dummy argument
        item%prev => item
 ^^^^^^^^^^^^^^^^^
./map_any_type1.f90:17:45: Declaration of 'item'
 type(list_item), pointer, intent(in) :: item
 ^^^^
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to