aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2008-01-20 16:58:15 +0000
committerPaul Thomas <pault@gcc.gnu.org>2008-01-20 16:58:15 +0000
commitf5d67ede42caa6e1442a4776a4929a8a96907caf (patch)
treedd7f7e6e4030beee514d48db62d509810015d5dd
parentbdf8f544b6775a6283d8f4cafcf50dd448e7be59 (diff)
downloadgcc-f5d67ede42caa6e1442a4776a4929a8a96907caf.zip
gcc-f5d67ede42caa6e1442a4776a4929a8a96907caf.tar.gz
gcc-f5d67ede42caa6e1442a4776a4929a8a96907caf.tar.bz2
re PR fortran/34861 (ICE in function with entry (and result?))
2008-01-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/34861 * resolve.c (resolve_entries): Do not do an array bounds check if the result symbols are the same. PR fortran/34854 * module.c (read_module) : Hide the symtree of the previous version of the symbol if this symbol is renamed. 2008-01-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/34784 * gfortran.dg/mapping_2.f90: Correct ubound expression for h4. PR fortran/34861 * gfortran.dg/entry_array_specs_3.f90: New test. PR fortran/34854 * gfortran.dg/use_rename_1.f90: New test. From-SVN: r131679
-rw-r--r--gcc/fortran/ChangeLog10
-rw-r--r--gcc/fortran/module.c2
-rw-r--r--gcc/fortran/resolve.c3
-rw-r--r--gcc/testsuite/ChangeLog11
-rw-r--r--gcc/testsuite/gfortran.dg/entry_array_specs_3.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/mapping_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/use_rename_1.f9027
7 files changed, 68 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 41fc1ad..86b0282 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,15 @@
2008-01-20 Paul Thomas <pault@gcc.gnu.org>
+ PR fortran/34861
+ * resolve.c (resolve_entries): Do not do an array bounds check
+ if the result symbols are the same.
+
+ PR fortran/34854
+ * module.c (read_module) : Hide the symtree of the previous
+ version of the symbol if this symbol is renamed.
+
+2008-01-20 Paul Thomas <pault@gcc.gnu.org>
+
PR fortran/34784
* array.c (gfc_check_constructor_type): Clear the expression ts
so that the checking starts from the deepest level of array
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 20cec83..fe57b9d 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3735,7 +3735,7 @@ read_module (void)
/* Make symtree inaccessible by renaming if the symbol has
been added by a USE statement without an ONLY(11.3.2). */
- if (st && only_flag
+ if (st && (only_flag || info->u.rsym.renamed)
&& !st->n.sym->attr.use_only
&& !st->n.sym->attr.use_rename
&& st->n.sym->module
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 0c4946e..38f8e64 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -496,7 +496,8 @@ resolve_entries (gfc_namespace *ns)
|| (el->sym->result->attr.pointer
!= ns->entries->sym->result->attr.pointer))
break;
- else if (as && fas && gfc_compare_array_spec (as, fas) == 0)
+ else if (as && fas && ns->entries->sym->result != el->sym->result
+ && gfc_compare_array_spec (as, fas) == 0)
gfc_error ("Function %s at %L has entries with mismatched "
"array specifications", ns->entries->sym->name,
&ns->entries->sym->declared_at);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c64655f..61be064 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,6 +1,17 @@
2008-01-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/34784
+ * gfortran.dg/mapping_2.f90: Correct ubound expression for h4.
+
+ PR fortran/34861
+ * gfortran.dg/entry_array_specs_3.f90: New test.
+
+ PR fortran/34854
+ * gfortran.dg/use_rename_1.f90: New test.
+
+2008-01-20 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/34784
* gfortran.dg/array_constructor_20.f90: New test.
* gfortran.dg/mapping_2.f90: Correct ubound expression for h4.
diff --git a/gcc/testsuite/gfortran.dg/entry_array_specs_3.f90 b/gcc/testsuite/gfortran.dg/entry_array_specs_3.f90
new file mode 100644
index 0000000..b54a270
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/entry_array_specs_3.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+!
+! PR fortran/34861, in which the test of conformity of the result array bounds
+! would barf because they are not known at compile time in this case.
+!
+! Contributed by Dick Hendrickson <dick.hendrickson@gmail.com>
+!
+FUNCTION I_IMFUD0 ( IDA2 , NDS4, NDS3) RESULT(I_IMFUDP)
+ INTEGER :: NDS4, NDS3
+ INTEGER :: IDA2(5,NDS4,NDS3,2)
+ INTEGER :: I_IMFUDP(SIZE(IDA2,1), SIZE(IDA2,2), SIZE(IDA2,3), SIZE(IDA2,4))
+ ENTRY I_IMFUDX (NDS4, NDS3, IDA2) RESULT(I_IMFUDP)
+ ENTRY I_IMFUDY (NDS3, NDS4, IDA2) RESULT(I_IMFUDP)
+ ENTRY I_IMFUDZ (NDS3, IDA2, NDS4) RESULT(I_IMFUDP)
+ I_IMFUDP = 1-IDA2(:,:,:,::NDS4-NDS3)
+END FUNCTION
diff --git a/gcc/testsuite/gfortran.dg/mapping_2.f90 b/gcc/testsuite/gfortran.dg/mapping_2.f90
index 7611c42..a490611 100644
--- a/gcc/testsuite/gfortran.dg/mapping_2.f90
+++ b/gcc/testsuite/gfortran.dg/mapping_2.f90
@@ -11,7 +11,7 @@ module test
function my_string(x)
integer i
real, intent(in) :: x(:)
- character(0) h4(1:minval([(1,i=1,0)],1))
+ character(0) h4(1:minval([(i,i=30,32)],15))
character(0) sv1(size(x,1):size(h4))
character(0) sv2(2*lbound(sv1,1):size(h4))
character(lbound(sv2,1)-3) my_string
diff --git a/gcc/testsuite/gfortran.dg/use_rename_1.f90 b/gcc/testsuite/gfortran.dg/use_rename_1.f90
new file mode 100644
index 0000000..01645f6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/use_rename_1.f90
@@ -0,0 +1,27 @@
+! { dg-do compile }
+! Tests the fix for PR34854, in which the second of the two subroutines would fail
+! because the the type declaration of nmoltype_phase would incorrectly conflict
+! with the type given to the module variable of the same name.
+!
+! Contributed by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+!
+module common_init_conf
+ integer, dimension(2) :: Nmoltype_phase
+end module common_init_conf
+
+subroutine read_initial_config_nml1()
+ use common_init_conf, nmoltype_phase_com => nmoltype_phase
+ use common_init_conf
+ implicit none
+ integer :: nmoltype_phase
+ namelist /confNmoltypePhase/ nmoltype_phase
+end subroutine read_initial_config_nml1
+
+subroutine read_initial_config_nml2()
+ use common_init_conf
+ use common_init_conf, nmoltype_phase_com => nmoltype_phase
+ implicit none
+ integer :: nmoltype_phase
+ namelist /confNmoltypePhase/ nmoltype_phase
+end subroutine read_initial_config_nml2
+! { dg-final { cleanup-modules "common_init_conf" } }