Issue 87215
Summary [Flang] Compilation error of host association using an implicit statement with a derived type
Labels flang:frontend
Assignees
Reporter ohno-fj
    ```
Version of flang-new : 19.0.0(cbcdf126ccc774c063b5d5140c1393ff5305dded)/AArch64
```

The following program for a `host association` using an `implicit` statement with a `derived type` results in a compilation error.

If `subroutine` is changed to main `program`, the compilation terminates normally.   
This program (scp235_23.f90) is attached at the end.


The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.

scp235_2.f90:
```fortran
PROGRAM A
  TYPE T
 INTEGER X
  END TYPE T
CONTAINS
  SUBROUTINE B
    IMPLICIT TYPE (T) (C)
    TYPE T
       INTEGER A
    END TYPE T
  END SUBROUTINE B
END PROGRAM A
```

```
$ flang-new scp235_2.f90
error: Semantic errors in scp235_2.f90
./scp235_2.f90:7:20: error: 't' from host is not accessible
      IMPLICIT TYPE (T) (C)
 ^
./scp235_2.f90:8:10: because: 't' is hidden by this entity
      TYPE T
           ^
$
```

```
$ gfortran scp235_2.f90; ./a.out
$
```

```
$ ifort -diag-disable=10448 scp235_2.f90; ./a.out
$
```

scp235_23.f90:
```fortran
PROGRAM A
 IMPLICIT TYPE (T) (C)
  TYPE T
     INTEGER A
  END TYPE T
END PROGRAM A
```

```
$ flang-new scp235_23.f90; ./a.out
$
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to