aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2008-01-06 22:00:00 +0000
committerPaul Thomas <pault@gcc.gnu.org>2008-01-06 22:00:00 +0000
commit5989df83be8402add1f7cad75ee98e7a8ac2dbda (patch)
tree90e6a3b9a4e806e921bd4b2e4e0dfd7151225906 /gcc
parentb8c9ec3da0d37a2b29715bb91b847b1e5dc188c5 (diff)
downloadgcc-5989df83be8402add1f7cad75ee98e7a8ac2dbda.zip
gcc-5989df83be8402add1f7cad75ee98e7a8ac2dbda.tar.gz
gcc-5989df83be8402add1f7cad75ee98e7a8ac2dbda.tar.bz2
re PR fortran/34545 (ICE when compiling Fortran 95 code)
2008-01-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/34545 * module.c (load_needed): If the namespace has no proc_name give it the module symbol. 2008-01-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/34545 * gfortran.dg/use_12.f90: New test. From-SVN: r131364
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/module.c6
-rw-r--r--gcc/testsuite/ChangeLog11
-rw-r--r--gcc/testsuite/gfortran.dg/use_12.f9025
4 files changed, 46 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 09155e3..6659ab5 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,8 +1,8 @@
-2008-01-06 Tobias Burnus <burnus@net-b.de>
+2008-01-06 Paul Thomas <pault@gcc.gnu.org>
- PR fortran/34689
- * interface.c (compare_actual_formal): Fix intent(out) check for
- function result variables.
+ PR fortran/34545
+ * module.c (load_needed): If the namespace has no proc_name
+ give it the module symbol.
2008-01-06 Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index f3c54b7..20528cb 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3525,6 +3525,12 @@ load_needed (pointer_info *p)
associate_integer_pointer (q, ns);
}
+ /* Use the module sym as 'proc_name' so that gfc_get_symbol_decl
+ doesn't go pear-shaped if the symbol is used. */
+ if (!ns->proc_name)
+ gfc_find_symbol (p->u.rsym.module, gfc_current_ns,
+ 1, &ns->proc_name);
+
sym = gfc_new_symbol (p->u.rsym.true_name, ns);
sym->module = gfc_get_string (p->u.rsym.module);
strcpy (sym->binding_label, p->u.rsym.binding_label);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5a83556..d66912b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2008-01-06 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/34545
+ * gfortran.dg/use_12.f90: New test.
+
+2008-01-06 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/34689
+ * interface.c (compare_actual_formal): Fix intent(out) check for
+ function result variables.
+
2008-01-06 Tobias Burnus <burnus@net-b.de>
PR fortran/34690
diff --git a/gcc/testsuite/gfortran.dg/use_12.f90 b/gcc/testsuite/gfortran.dg/use_12.f90
new file mode 100644
index 0000000..82614b5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/use_12.f90
@@ -0,0 +1,25 @@
+! { dg-do compile }
+! Tests the fix of PR34545, in which the 'numclusters' that determines the size
+! of fnres was not properly associated.
+!
+! Reported by Jon D. Richards <jon_d_r@msn.com>
+!
+module m1
+ integer :: numclusters = 2
+end module m1
+
+module m2
+ contains
+ function get_nfirst( ) result(fnres)
+ use m1, only: numclusters
+ real :: fnres(numclusters) ! change to REAL and it works!!
+ end function get_nfirst
+end module m2
+
+program kmeans_driver
+ use m1
+ use m2
+ integer :: nfirst(3)
+ nfirst(1:numclusters) = get_nfirst( )
+end program kmeans_driver
+! { dg-final { cleanup-modules "m1 m2" } }