brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 608d193 Raw
108 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! Check for C1801 - C18053 4module m5  public s6  !ERROR: Interoperable array must have at least one element7  real, bind(c) :: x(0)8contains9  subroutine s10  end11end12 13program main14  use m15  type, abstract :: v16    integer :: i17  end type18 19  ! ERROR: An interoperable derived type cannot have the SEQUENCE attribute20  type, bind(c) :: t121    sequence22    integer :: x23  end type24 25  ! ERROR: An interoperable derived type cannot have a type parameter26  type, bind(c) :: t2(k)27    integer, KIND :: k28    integer :: x29  end type30 31  ! ERROR: A derived type with the BIND attribute cannot be an extended derived type32  type, bind(c), extends(v) :: t333    integer :: x34  end type35 36  type, bind(c) :: t437    integer :: x38   contains39    ! ERROR: An interoperable derived type cannot have a type bound procedure40    procedure, nopass :: b => s41  end type42 43  ! WARNING: A derived type with the BIND attribute should not be empty [-Wempty-bind-c-derived-type]44  type, bind(c) :: t545  end type46 47  type, bind(c) :: t648    ! ERROR: An interoperable derived type cannot have a pointer or allocatable component49    integer, pointer :: x50  end type51 52  type, bind(c) :: t753    ! ERROR: An interoperable derived type cannot have a pointer or allocatable component54    integer, allocatable :: y55  end type56 57  type :: t858    integer :: x59  end type60 61  type :: t8a62    integer, pointer :: x63  end type64 65  type, bind(c) :: t966    !WARNING: Derived type of component 'x' of an interoperable derived type should have the BIND attribute67    type(t8) :: x68    !ERROR: Component 'y' of an interoperable derived type must have an interoperable type but does not69    type(t8a) :: y70    integer :: z71  end type72 73  type, bind(c) :: t1074    !WARNING: A CHARACTER component of an interoperable type should have length 1 [-Wbind-c-char-length]75    character(len=2) x76  end type77  type, bind(c) :: t1178    !ERROR: Each component of an interoperable derived type must have an interoperable type79    character(kind=2) x80  end type81  type, bind(c) :: t1282    !PORTABILITY: A LOGICAL component of an interoperable type should have the interoperable KIND=C_BOOL [-Wlogical-vs-c-bool]83    logical(kind=8) x84  end type85  type, bind(c) :: t1386    !ERROR: Each component of an interoperable derived type must have an interoperable type87    real(kind=2) x88  end type89  type, bind(c) :: t1490    !ERROR: Each component of an interoperable derived type must have an interoperable type91    complex(kind=2) x92  end type93  type, bind(c) :: t1594    !ERROR: An array component of an interoperable type must have at least one element95    real :: x(0)96  end type97 98  interface99    subroutine badAssumedLen(x,y,z) bind(c)100      !ERROR: A BIND(C) object must have an interoperable type101      character(*), pointer :: x102      !ERROR: A BIND(C) object must have an interoperable type103      character(*), allocatable :: y104      character(*) z ! ok105    end106  end interface107end108