OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [bind_c_usage_24.f90] - Blame information for rev 708

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! { dg-additional-sources bind_c_usage_24_c.c }
3
!
4
! PR fortran/48858
5
! PR fortran/48820
6
!
7
! TS 29113: BIND(C) with OPTIONAL
8
!
9
module m
10
  use iso_c_binding
11
  interface
12
    subroutine c_proc (is_present, var) bind(C)
13
      import
14
      logical(c_bool), value    :: is_present
15
      integer(c_int),  optional :: var
16
    end subroutine
17
  end interface
18
contains
19
  subroutine subtest (is_present, var) bind(C)
20
    logical(c_bool), intent(in),    value    :: is_present
21
    integer(c_int),  intent(inout), optional :: var
22
    if (is_present) then
23
      if (.not. present (var)) call abort ()
24
      if (var /= 43) call abort ()
25
      var = -45
26
    else
27
      if (present (var)) call abort ()
28
    end if
29
  end subroutine subtest
30
end module m
31
 
32
program test
33
  use m
34
  implicit none
35
  integer :: val
36
 
37
  val = 4
38
  call c_proc (.false._c_bool)
39
  call c_proc (.true._c_bool, val)
40
  if (val /= 7) call abort ()
41
end program test
42
 
43
! { dg-final { cleanup-modules "m" } }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.