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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do compile }
2
! { dg-options "-std=f95" }
3
! { dg-shouldfail "Fortran 2003 feature with -std=f95" }
4
! Test whether import does not work with -std=f95
5
! PR fortran/29601
6
 
7
subroutine test(x)
8
  type myType3
9
    sequence
10
    integer :: i
11
  end type myType3
12
  type(myType3) :: x
13
  if(x%i /= 7) call abort()
14
  x%i = 1
15
end subroutine test
16
 
17
 
18
subroutine bar(x,y)
19
  type myType
20
    sequence
21
    integer :: i
22
  end type myType
23
  type(myType) :: x
24
  integer(8) :: y
25
  if(y /= 8) call abort()
26
  if(x%i /= 2) call abort()
27
  x%i = 5
28
  y   = 42
29
end subroutine bar
30
 
31
module testmod
32
  implicit none
33
  integer, parameter :: kind = 8
34
  type modType
35
    real :: rv
36
  end type modType
37
  interface
38
    subroutine other(x,y)
39
      import ! { dg-error "Fortran 2003: IMPORT statement" }
40
      type(modType) :: y ! { dg-error "not been declared within the interface" }
41
      real(kind)    :: x ! { dg-error "has not been declared" }
42
    end subroutine
43
  end interface
44
end module testmod
45
 
46
program foo
47
  integer, parameter :: dp = 8
48
  type myType
49
    sequence
50
    integer :: i
51
  end type myType
52
  type myType3
53
    sequence
54
    integer :: i
55
  end type myType3
56
  interface
57
    subroutine bar(x,y)
58
      import ! { dg-error "Fortran 2003: IMPORT statement" }
59
      type(myType) :: x ! { dg-error "not been declared within the interface" }
60
      integer(dp)  :: y ! { dg-error "has not been declared" }
61
    end subroutine bar
62
    subroutine test(x)
63
      import :: myType3 ! { dg-error "Fortran 2003: IMPORT statement" }
64
      import myType3 ! { dg-error "Fortran 2003: IMPORT statement" }
65
      type(myType3) :: x ! { dg-error "not been declared within the interface" }
66
    end subroutine test
67
  end interface
68
 
69
  type(myType) :: y
70
  type(myType3) :: z
71
  integer(dp) :: i8
72
  y%i = 2
73
  i8 = 8
74
  call bar(y,i8) ! { dg-error "Type mismatch in argument" }
75
  if(y%i /= 5 .or. i8/= 42) call abort()
76
  z%i = 7
77
  call test(z) ! { dg-error "Type mismatch in argument" }
78
  if(z%i /= 1) call abort()
79
end program foo
80
! { dg-final { cleanup-modules "testmod" } }

powered by: WebSVN 2.1.0

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