aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2010-01-07 09:12:10 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2010-01-07 09:12:10 +0100
commit2a3c437d064e6d014ebf82453ba57a02a701ede9 (patch)
tree2a7118b6434bc55292d6637b808a9c67bc24efec
parent64b33a7e1eb495404a6a74b8b69368580b1ee874 (diff)
downloadgcc-2a3c437d064e6d014ebf82453ba57a02a701ede9.zip
gcc-2a3c437d064e6d014ebf82453ba57a02a701ede9.tar.gz
gcc-2a3c437d064e6d014ebf82453ba57a02a701ede9.tar.bz2
re PR fortran/42597 (ICE with procedure pointer initialized to null())
2010-01-07 Tobias Burnus <burnus@net-b.de> 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 <burnus@net-b.de> PR fortran/42597 * gfortran.dg/proc_ptr_26.f90: New test. From-SVN: r155688
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-decl.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_26.f9031
4 files changed, 45 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 43a3af2..dc3aa97 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,11 @@
2010-01-07 Tobias Burnus <burnus@net-b.de>
+ 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 <burnus@net-b.de>
+
PR fortran/41872
* trans-decl.c (gfc_trans_deferred_vars): Don't initialize
allocatable scalars with SAVE attribute.
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index cf9bef3..612c6f6 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 6e0a903..459dde3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2010-01-07 Tobias Burnus <burnus@net-b.de>
+ PR fortran/42597
+ * gfortran.dg/proc_ptr_26.f90: New test.
+
+2010-01-07 Tobias Burnus <burnus@net-b.de>
+
PR fortran/41872
* gfortran.dg/allocatable_scalar_7.f90: New test.
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 0000000..044f0a4
--- /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" } }