From: Tobias Burnus Date: Thu, 7 Jan 2010 08:12:10 +0000 (+0100) Subject: re PR fortran/42597 (ICE with procedure pointer initialized to null()) X-Git-Tag: releases/gcc-4.5.0~1362 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a3c437d064e6d014ebf82453ba57a02a701ede9;p=thirdparty%2Fgcc.git re PR fortran/42597 (ICE with procedure pointer initialized to null()) 2010-01-07 Tobias Burnus PR fortran/42597 * trans-decl.c (get_proc_pointer_decl): Fix call to gfc_conv_initializer for array-valued proc-pointer funcs. 2010-01-07 Tobias Burnus PR fortran/42597 * gfortran.dg/proc_ptr_26.f90: New test. From-SVN: r155688 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 43a3af2fe19c..dc3aa9718b13 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2010-01-07 Tobias Burnus + + PR fortran/42597 + * trans-decl.c (get_proc_pointer_decl): Fix call to + gfc_conv_initializer for array-valued proc-pointer funcs. + 2010-01-07 Tobias Burnus PR fortran/41872 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index cf9bef31d937..612c6f612969 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1349,7 +1349,9 @@ get_proc_pointer_decl (gfc_symbol *sym) { /* Add static initializer. */ DECL_INITIAL (decl) = gfc_conv_initializer (sym->value, &sym->ts, - TREE_TYPE (decl), sym->attr.dimension, sym->attr.proc_pointer); + TREE_TYPE (decl), + sym->attr.proc_pointer ? false : sym->attr.dimension, + sym->attr.proc_pointer); } attributes = add_attributes_to_decl (sym->attr, NULL_TREE); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6e0a9038ba8b..459dde397fff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-01-07 Tobias Burnus + + PR fortran/42597 + * gfortran.dg/proc_ptr_26.f90: New test. + 2010-01-07 Tobias Burnus PR fortran/41872 diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_26.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_26.f90 new file mode 100644 index 000000000000..044f0a403bd5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_26.f90 @@ -0,0 +1,31 @@ +! { dg-do run } +! +! PR fortran/42597 +! +! Contributed by mrestelli@gmail.com +! + +module mod_a + implicit none + + abstract interface + pure function intf(x) result(y) + real, intent(in) :: x(:,:) + real :: y(size(x,1),size(x,1),size(x,2)) + end function intf + end interface + + procedure(intf), pointer :: p_fun => null() +end module mod_a + +program main + use mod_a + implicit none + + procedure(intf), pointer :: p_fun2 => null() + + if (associated(p_fun) .or. associated(p_fun2)) & + call abort () +end program main + +! { dg-final { cleanup-modules "mod_a" } }