aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/compiler-directive_1.f90
blob: 75f28dcc928d3480fcd67dc6cc05c7f5cc36e5cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
! { dg-do compile }
!
! PR fortran/34112
!
! Check for calling convention consitency
! in procedure-pointer assignments.

program test
  interface
    subroutine sub1()
    end subroutine sub1
    subroutine sub2()
      !GCC$ ATTRIBUTES CDECL :: sub2
    end subroutine sub2
    subroutine sub3()
      !GCC$ ATTRIBUTES STDCALL :: sub3
    end subroutine sub3
    subroutine sub4()
!GCC$ ATTRIBUTES FASTCALL :: sub4
    end subroutine sub4
  end interface

  !gcc$ attributes cdecl :: cdecl
  !gcc$ attributes stdcall :: stdcall
  procedure(), pointer :: ptr
  procedure(), pointer :: cdecl
  procedure(), pointer :: stdcall
  procedure(), pointer :: fastcall
  !gcc$ attributes fastcall :: fastcall

  ! Valid:
  ptr => sub1
  cdecl => sub2
  stdcall => sub3
  fastcall => sub4

  ! Invalid:
  ptr => sub3 ! { dg-error "mismatch in the calling convention" }
  ptr => sub4 ! { dg-error "mismatch in the calling convention" }
  cdecl => sub3 ! { dg-error "mismatch in the calling convention" }
  cdecl => sub4 ! { dg-error "mismatch in the calling convention" }
  stdcall => sub1 ! { dg-error "mismatch in the calling convention" }
  stdcall => sub2 ! { dg-error "mismatch in the calling convention" }
  stdcall => sub4 ! { dg-error "mismatch in the calling convention" }
  fastcall => sub1 ! { dg-error "mismatch in the calling convention" }
  fastcall => sub2 ! { dg-error "mismatch in the calling convention" }
  fastcall => sub3 ! { dg-error "mismatch in the calling convention" }
end program