brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · fb05264 Raw
69 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Check for semantic errors in num_images() function calls3 4program num_images_with_team_type5  use iso_fortran_env, only : team_type6  implicit none7 8  type(team_type) home, league(2)9  integer n10  integer :: standard_initial_value = -111  integer coindexed[*]12  integer array(1)13 14  !___ standard-conforming statement with no optional arguments present ___15  n = num_images()16 17  !___ standard-conforming statements with team_number argument present ___18  n = num_images(-1)19  n = num_images(team_number = -1)20  n = num_images(team_number = standard_initial_value)21  n = num_images(standard_initial_value)22  n = num_images(coindexed[1])23 24  !___ standard-conforming statements with team_type argument present ___25  n = num_images(home)26  n = num_images(team=home)27 28  !___ non-conforming statements ___29 30  ! non-scalar integer argument 31  !ERROR: unknown keyword argument to intrinsic 'num_images'32  n = num_images(team_number=array)33 34  ! non-scalar team_type argument 35  !ERROR: unknown keyword argument to intrinsic 'num_images'36  n = num_images(team=league)37 38  ! incorrectly typed argument39  !ERROR: too many actual arguments for intrinsic 'num_images'40  n = num_images(3.4)41 42  !ERROR: too many actual arguments for intrinsic 'num_images'43  n = num_images(1, -1)44 45  !ERROR: too many actual arguments for intrinsic 'num_images'46  n = num_images(home, standard_initial_value)47 48  ! keyword argument with incorrect type49  !ERROR: unknown keyword argument to intrinsic 'num_images'50  n = num_images(team_number=1.1)51 52  ! incorrect keyword argument name but valid type (type number)53  !ERROR: unknown keyword argument to intrinsic 'num_images'54  n = num_images(team_num=-1)55 56  ! incorrect keyword argument name but valid type (team_type)57  !ERROR: unknown keyword argument to intrinsic 'num_images'58  n = num_images(my_team=home)59 60  ! correct keyword argument name but mismatched type61  !ERROR: unknown keyword argument to intrinsic 'num_images'62  n = num_images(team=-1)63 64  ! correct keyword argument name but mismatched type65  !ERROR: unknown keyword argument to intrinsic 'num_images'66  n = num_images(team_number=home)67 68end program num_images_with_team_type69