brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 05b7dfb Raw
57 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2module m3 contains4  subroutine s1(x)5    character(3) :: x6  end7  subroutine s2(x)8    character(3) :: x(1)9  end10  subroutine s3(x)11    character(3) :: x(:)12  end13  subroutine s4(x)14    character(3) :: x(..)15  end16  subroutine s5(x)17    character(3), allocatable :: x18  end19  subroutine s6(x)20    character(3), pointer :: x21  end22end23 24program test25  use m26  character(2) short, shortarr(1)27  character(2), allocatable :: shortalloc28  character(2), pointer :: shortptr29  character(4) long, longarr(1)30  character(4), allocatable :: longalloc31  character(4), pointer :: longptr32  !WARNING: Actual argument variable length '2' is less than expected length '3' [-Wshort-character-actual]33  call s1(short)34  !ERROR: Actual argument array has fewer characters (2) than dummy argument 'x=' array (3)35  call s2(shortarr)36  !ERROR: Actual argument variable length '2' does not match the expected length '3'37  call s3(shortarr)38  !ERROR: Actual argument variable length '2' does not match the expected length '3'39  call s4(shortarr)40  !ERROR: Actual argument variable length '2' does not match the expected length '3'41  call s5(shortalloc)42  !ERROR: Actual argument variable length '2' does not match the expected length '3'43  !ERROR: Target type CHARACTER(KIND=1,LEN=2_8) is not compatible with pointer type CHARACTER(KIND=1,LEN=3_8)44  call s6(shortptr)45  call s1(long) ! ok46  call s2(longarr) ! ok47  !ERROR: Actual argument variable length '4' does not match the expected length '3'48  call s3(longarr)49  !ERROR: Actual argument variable length '4' does not match the expected length '3'50  call s4(longarr)51  !ERROR: Actual argument variable length '4' does not match the expected length '3'52  call s5(longalloc)53  !ERROR: Actual argument variable length '4' does not match the expected length '3'54  !ERROR: Target type CHARACTER(KIND=1,LEN=4_8) is not compatible with pointer type CHARACTER(KIND=1,LEN=3_8)55  call s6(longptr)56end57