aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2007-02-12 23:39:51 +0000
committerPaul Thomas <pault@gcc.gnu.org>2007-02-12 23:39:51 +0000
commite8c30b5f9a11fed775dddf8c15706ae251fdd2d5 (patch)
tree80aed157475351f59b91ab984cb2a2c6db54191f
parent8ea6dfaef4e67c1a505b1d7760a4fbac5f57bc36 (diff)
downloadgcc-e8c30b5f9a11fed775dddf8c15706ae251fdd2d5.zip
gcc-e8c30b5f9a11fed775dddf8c15706ae251fdd2d5.tar.gz
gcc-e8c30b5f9a11fed775dddf8c15706ae251fdd2d5.tar.bz2
[multiple changes]
2007-02-13 Paul Thomas <pault@gcc.gnu.org> PR fortran/30554 * module.c (read_module): Set pointer_info to referenced if the symbol has no namespace. 2007-02-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/30554 * gfortran.dg/used_dummy_types_7.f90: New test. From-SVN: r121865
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/module.c12
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gfortran.dg/used_dummy_types_7.f9045
4 files changed, 65 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 86a5652..34a470d 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2007-02-13 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/30554
+ * module.c (read_module): Set pointer_info to referenced if the
+ symbol has no namespace.
+
2007-02-12 Nick Clifton <nickc@redhat.com>
* lang.opt: Add Warning attribute to warning options.
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 1dd81e3..efb27e3 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3339,7 +3339,7 @@ read_module (void)
char name[GFC_MAX_SYMBOL_LEN + 1];
gfc_intrinsic_op i;
int ambiguous, j, nuse, symbol;
- pointer_info *info;
+ pointer_info *info, *q;
gfc_use_rename *u;
gfc_symtree *st;
gfc_symbol *sym;
@@ -3390,6 +3390,16 @@ read_module (void)
info->u.rsym.state = USED;
info->u.rsym.sym = sym;
+ /* Some symbols do not have a namespace (eg. formal arguments),
+ so the automatic "unique symtree" mechanism must be suppressed
+ by marking them as referenced. */
+ q = get_integer (info->u.rsym.ns);
+ if (q->u.pointer == NULL)
+ {
+ info->u.rsym.referenced = 1;
+ continue;
+ }
+
/* If possible recycle the symtree that references the symbol.
If a symtree is not found and the module does not import one,
a unique-name symtree is found by read_cleanup. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 60e00e2..1255556 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,9 +1,7 @@
-2007-02-12 Simon Martin <simartin@users.sourceforge.net>
+2007-02-13 Paul Thomas <pault@gcc.gnu.org>
- PR c++/14622
- * g++.dg/template/instantiate9.C: New test.
- * g++.old-deja/g++.pt/instantiate12.C: Fixed type mismatches in explicit
- instantiations.
+ PR fortran/30554
+ * gfortran.dg/used_dummy_types_7.f90: New test..
2007-02-12 Uros Bizjak <ubizjak@gmail.com>
diff --git a/gcc/testsuite/gfortran.dg/used_dummy_types_7.f90 b/gcc/testsuite/gfortran.dg/used_dummy_types_7.f90
new file mode 100644
index 0000000..9e591b2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/used_dummy_types_7.f90
@@ -0,0 +1,45 @@
+! { dg-do compile }
+! This tests a patch for a regression caused by the second part of
+! the fix for PR30554. The linked derived types dummy_atom and
+! dummy_atom_list caused a segment fault because they do not have
+! a namespace.
+!
+! Contributed by Daniel Franke <franke.daniel@gmail.com>
+!
+MODULE types
+TYPE :: dummy_atom_list
+ TYPE(dummy_atom), DIMENSION(:), POINTER :: table => null()
+END TYPE
+
+TYPE :: dummy_atom
+ TYPE(dummy_atom_private), POINTER :: p => null()
+END TYPE
+
+TYPE :: dummy_atom_private
+ INTEGER :: id
+END TYPE
+END MODULE
+
+MODULE atom
+USE types, ONLY: dummy_atom
+INTERFACE
+ SUBROUTINE dummy_atom_insert_symmetry_mate(this, other)
+ USE types, ONLY: dummy_atom
+ TYPE(dummy_atom), INTENT(inout) :: this
+ TYPE(dummy_atom), INTENT(in) :: other
+ END SUBROUTINE
+END INTERFACE
+END MODULE
+
+MODULE list
+INTERFACE
+ SUBROUTINE dummy_atom_list_insert(this, atom)
+ USE types, ONLY: dummy_atom_list
+ USE atom, ONLY: dummy_atom
+
+ TYPE(dummy_atom_list), INTENT(inout) :: this
+ TYPE(dummy_atom), INTENT(in) :: atom
+ END SUBROUTINE
+END INTERFACE
+END MODULE
+! { dg-final { cleanup-modules "atom types list" } }