diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/pointer_check_6.f90 | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/pointer_check_6.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/pointer_check_6.f90 | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/pointer_check_6.f90 b/gcc/testsuite/gfortran.dg/pointer_check_6.f90 new file mode 100644 index 000000000..2f7373fe6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pointer_check_6.f90 @@ -0,0 +1,118 @@ +! { dg-do run } +! { dg-options "-fcheck=pointer" } +! +! { dg-shouldfail "pointer check" } +! { dg-output ".*At line 104 of file .*Fortran runtime error: Pointer actual argument 'a' is not associated.*" } +! +! PR fortran/40604 +! +! The following cases are all valid, but were failing +! for one or the other reason. +! +! Contributed by Janus Weil and Tobias Burnus. +! + +subroutine test1() + call test(uec=-1) +contains + subroutine test(str,uec) + implicit none + character*(*), intent(in), optional:: str + integer, intent(in), optional :: uec + end subroutine +end subroutine test1 + +module m + interface matrixMult + Module procedure matrixMult_C2 + End Interface +contains + subroutine test + implicit none + complex, dimension(0:3,0:3) :: m1,m2 + print *,Trace(MatrixMult(m1,m2)) + end subroutine + complex function trace(a) + implicit none + complex, intent(in), dimension(0:3,0:3) :: a + end function trace + function matrixMult_C2(a,b) result(matrix) + implicit none + complex, dimension(0:3,0:3) :: matrix,a,b + end function matrixMult_C2 +end module m + +SUBROUTINE plotdop(amat) + IMPLICIT NONE + REAL, INTENT (IN) :: amat(3,3) + integer :: i1 + real :: pt(3) + i1 = 1 + pt = MATMUL(amat,(/i1,i1,i1/)) +END SUBROUTINE plotdop + + FUNCTION evaluateFirst(s,n)result(number) + IMPLICIT NONE + CHARACTER(len =*), INTENT(inout) :: s + INTEGER,OPTIONAL :: n + REAL :: number + number = 1.1 + end function + +SUBROUTINE rw_inp(scpos) + IMPLICIT NONE + REAL scpos + + interface + FUNCTION evaluateFirst(s,n)result(number) + IMPLICIT NONE + CHARACTER(len =*), INTENT(inout) :: s + INTEGER,OPTIONAL :: n + REAL :: number + end function + end interface + + CHARACTER(len=100) :: line + scpos = evaluatefirst(line) +END SUBROUTINE rw_inp + +program test + integer, pointer :: a +! nullify(a) + allocate(a) + a = 1 + call sub1a(a) + call sub1b(a) + call sub1c() +contains + subroutine sub1a(a) + integer, pointer :: a + call sub2(a) + call sub3(a) + call sub4(a) + end subroutine sub1a + subroutine sub1b(a) + integer, pointer,optional :: a + call sub2(a) + call sub3(a) + call sub4(a) + end subroutine sub1b + subroutine sub1c(a) + integer, pointer,optional :: a + call sub4(a) +! call sub2(a) ! << Invalid - working correctly, but not allowed in F2003 + call sub3(a) ! << INVALID + end subroutine sub1c + subroutine sub4(b) + integer, optional,pointer :: b + end subroutine + subroutine sub2(b) + integer, optional :: b + end subroutine + subroutine sub3(b) + integer :: b + end subroutine +end + + +! { dg-final { cleanup-modules "m" } } |