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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [protected_6.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-shouldfail "Invalid Fortran 2003 code" }
3
! { dg-options "-std=f2003 -fall-intrinsics" }
4
! PR fortran/23994
5
!
6
! Test PROTECTED attribute. Within the module everything is allowed.
7
! Outside (use-associated): For pointers, their association status
8
! may not be changed. For nonpointers, their value may not be changed.
9
!
10
! Test of a invalid code
11
 
12
module protmod
13
  implicit none
14
  integer, Protected          :: a
15
  integer, protected, target  :: at
16
  integer, protected, pointer :: ap
17
end module protmod
18
 
19
program main
20
  use protmod
21
  implicit none
22
  a = 43       ! { dg-error "variable definition context" }
23
  ap => null() ! { dg-error "pointer association context" }
24
  nullify(ap)  ! { dg-error "pointer association context" }
25
  ap => at     ! { dg-error "pointer association context" }
26
  ap = 3       ! OK
27
  allocate(ap) ! { dg-error "pointer association context" }
28
  ap = 73      ! OK
29
  call increment(a,at) ! { dg-error "variable definition context" }
30
  call pointer_assignments(ap) ! { dg-error "pointer association context" }
31
contains
32
  subroutine increment(a1,a3)
33
    integer, intent(inout) :: a1, a3
34
    a1 = a1 + 1
35
    a3 = a3 + 1
36
  end subroutine increment
37
  subroutine pointer_assignments(p)
38
    integer, pointer,intent (inout) :: p
39
    p => null()
40
  end subroutine pointer_assignments
41
end program main
42
 
43
module prot2
44
  implicit none
45
contains
46
  subroutine bar
47
    real, protected :: b ! { dg-error "only allowed in specification part of a module" }
48
  end subroutine bar
49
end module prot2
50
 
51
! { dg-final { cleanup-modules "protmod" } }

powered by: WebSVN 2.1.0

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