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

Subversion Repositories openrisc

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

Go to most recent revision | 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 good1
13
  implicit none
14
  integer              :: a
15
  integer              :: b,c
16
  protected            :: c
17
  equivalence (a,c) ! { dg-error "Either all or none of the objects in the EQUIVALENCE" }
18
end module good1
19
 
20
 
21
module bad1
22
  implicit none
23
  integer, protected   :: a
24
  integer              :: b,c
25
  protected            :: c
26
  equivalence (a,b) ! { dg-error "Either all or none of the objects in the EQUIVALENCE" }
27
end module bad1
28
 
29
module bad2
30
  implicit none
31
  integer, protected   :: a
32
  integer              :: b,c,d
33
  protected            :: c
34
  common /one/ a,b  ! { dg-error "PROTECTED attribute conflicts with COMMON" }
35
  common /two/ c,d  ! { dg-error "PROTECTED attribute conflicts with COMMON" }
36
end module bad2
37
 
38
module good2
39
  implicit none
40
  type myT
41
     integer :: j
42
     integer, pointer :: p
43
     real, allocatable, dimension(:) :: array
44
  end type myT
45
  type(myT), save :: t
46
  protected :: t
47
end module good2
48
 
49
program main
50
  use good2
51
  implicit none
52
  t%j = 15             ! { dg-error "variable definition context" }
53
  nullify(t%p)         ! { dg-error "pointer association context" }
54
  allocate(t%array(15))! { dg-error "variable definition context" }
55
end program main
56
 
57
! { dg-final { cleanup-modules "good1 good2 bad1 bad2" } }

powered by: WebSVN 2.1.0

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