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/proc_ptr_11.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/proc_ptr_11.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/proc_ptr_11.f90 | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_11.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_11.f90 new file mode 100644 index 000000000..4e8b3c253 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_11.f90 @@ -0,0 +1,62 @@ +! { dg-do compile } +! +! PR 38290: Procedure pointer assignment checking. +! +! Test case found at http://de.wikibooks.org/wiki/Fortran:_Fortran_2003:_Zeiger +! Adapted by Janus Weil <janus@gcc.gnu.org> + +program bsp + implicit none + + abstract interface + subroutine up() + end subroutine up + end interface + + procedure( up ) , pointer :: pptr + procedure(isign), pointer :: q + + procedure(iabs),pointer :: p1 + procedure(f), pointer :: p2 + + pointer :: p3 + interface + function p3(x) + real(8) :: p3,x + intent(in) :: x + end function p3 + end interface + + pptr => add ! { dg-error "is not a subroutine" } + + q => add + + print *, pptr() ! { dg-error "is not a function" } + + p1 => iabs + p2 => iabs + p1 => f + p2 => f + p2 => p1 + p1 => p2 + + p1 => abs ! { dg-error "Type/kind mismatch in return value" } + p2 => abs ! { dg-error "Type/kind mismatch in return value" } + + p3 => dsin + p3 => sin ! { dg-error "Type/kind mismatch in return value" } + + contains + + function add( a, b ) + integer :: add + integer, intent( in ) :: a, b + add = a + b + end function add + + integer function f(x) + integer,intent(in) :: x + f = 317 + x + end function + +end program bsp |