1! { dg-do compile } 2! 3! PR fortran/34112 4! 5! Check for calling convention consitency 6! in procedure-pointer assignments. 7 8program test 9 interface 10 subroutine sub1() 11 end subroutine sub1 12 subroutine sub2() 13 !GCC$ ATTRIBUTES CDECL :: sub2 14 end subroutine sub2 15 subroutine sub3() 16 !GCC$ ATTRIBUTES STDCALL :: sub3 17 end subroutine sub3 18 subroutine sub4() 19!GCC$ ATTRIBUTES FASTCALL :: sub4 20 end subroutine sub4 21 end interface 22 23 !gcc$ attributes cdecl :: cdecl 24 !gcc$ attributes stdcall :: stdcall 25 procedure(), pointer :: ptr 26 procedure(), pointer :: cdecl 27 procedure(), pointer :: stdcall 28 procedure(), pointer :: fastcall 29 !gcc$ attributes fastcall :: fastcall 30 31 ! Valid: 32 ptr => sub1 33 cdecl => sub2 34 stdcall => sub3 35 fastcall => sub4 36 37 ! Invalid: 38 ptr => sub3 ! { dg-error "mismatch in the calling convention" } 39 ptr => sub4 ! { dg-error "mismatch in the calling convention" } 40 cdecl => sub3 ! { dg-error "mismatch in the calling convention" } 41 cdecl => sub4 ! { dg-error "mismatch in the calling convention" } 42 stdcall => sub1 ! { dg-error "mismatch in the calling convention" } 43 stdcall => sub2 ! { dg-error "mismatch in the calling convention" } 44 stdcall => sub4 ! { dg-error "mismatch in the calling convention" } 45 fastcall => sub1 ! { dg-error "mismatch in the calling convention" } 46 fastcall => sub2 ! { dg-error "mismatch in the calling convention" } 47 fastcall => sub3 ! { dg-error "mismatch in the calling convention" } 48end program 49