diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2006-11-09 20:22:19 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2006-11-09 20:22:19 +0000 |
commit | ff883a9572d6f93e8d600c8c6add4dac45b9785a (patch) | |
tree | 233bf1930517c7b91322bb359d2396487e9f1fe7 /gcc | |
parent | 6acf0b3843737f9f95298465fdcf0d532c1995a4 (diff) | |
download | gcc-ff883a9572d6f93e8d600c8c6add4dac45b9785a.zip gcc-ff883a9572d6f93e8d600c8c6add4dac45b9785a.tar.gz gcc-ff883a9572d6f93e8d600c8c6add4dac45b9785a.tar.bz2 |
re PR fortran/29744 (Type renaming crashes gfortran with excessive memory usage)
2006-11-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29744
* trans-types.c (gfc_get_derived_type): Ensure that the
proc_name namespace is not the same as the owner namespace and
that identical derived types in the same namespace share the
same backend_decl.
2006-11-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29744
* gfortran.dg/used_types_12.f90: New test.
From-SVN: r118627
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/trans-types.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/used_types_12.f90 | 30 |
4 files changed, 48 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fcd1c4e..7b5afcf 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,13 @@ 2006-11-09 Paul Thomas <pault@gcc.gnu.org> + PR fortran/29744 + * trans-types.c (gfc_get_derived_type): Ensure that the + proc_name namespace is not the same as the owner namespace and + that identical derived types in the same namespace share the + same backend_decl. + +2006-11-09 Paul Thomas <pault@gcc.gnu.org> + PR fortran/29699 * trans-array.c (structure_alloc_comps): Detect pointers to arrays and use indirect reference to declaration. diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index ecae593..56575b0 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1484,7 +1484,8 @@ gfc_get_derived_type (gfc_symbol * derived) build the parent version and use it in the current namespace. */ if (derived->ns->parent) ns = derived->ns->parent; - else if (derived->ns->proc_name) + else if (derived->ns->proc_name + && derived->ns->proc_name->ns != derived->ns) /* Derived types in an interface body obtain their parent reference through the proc_name symbol. */ ns = derived->ns->proc_name->ns; @@ -1592,6 +1593,9 @@ other_equal_dts: /* Add this backend_decl to all the other, equal derived types and their components in this and sibling namespaces. */ + for (dt = derived->ns->derived_types; dt; dt = dt->next) + copy_dt_decls_ifequal (derived, dt->derived); + for (ns = derived->ns->sibling; ns; ns = ns->sibling) for (dt = ns->derived_types; dt; dt = dt->next) copy_dt_decls_ifequal (derived, dt->derived); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cf60056..d56bd04 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-11-09 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/29744 + * gfortran.dg/used_types_12.f90: New test. + 2006-11-09 Serge Belyshev <belyshev@depni.sinp.msu.ru> PR middle-end/29726 diff --git a/gcc/testsuite/gfortran.dg/used_types_12.f90 b/gcc/testsuite/gfortran.dg/used_types_12.f90 new file mode 100644 index 0000000..adfa1f7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/used_types_12.f90 @@ -0,0 +1,30 @@ +! { dg-do compile } +! Tests the fix PR29744, which is really a repeat of PR19362. +! The problem came about because the test for PR19362 shifted +! the fix to a subroutine, rather than the main program that +! it originally occurred in. Fixes for subsequent PRs introduced +! a difference between the main program and a contained procedure +! that resulted in the compiler going into an infinite loop. +! +! Contributed by Harald Anlauf <anlauf@gmx.de> +! and originally by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> +! +MODULE M + TYPE T0 + SEQUENCE + INTEGER I + END TYPE +END + +PROGRAM MAIN + USE M, T1 => T0 + TYPE T0 + SEQUENCE + INTEGER I + END TYPE + TYPE(T0) :: BAR + TYPE(T1) :: BAZ + BAZ = BAR +END +! { dg-final { cleanup-modules "M" } } + |