aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2006-03-28 10:13:50 +0000
committerPaul Thomas <pault@gcc.gnu.org>2006-03-28 10:13:50 +0000
commit37e47ee96393168103a35a792e40b3c808ebc192 (patch)
tree67e215c9e639e3eb52fdc4220f02441cfda969a5
parent7f166b0a8e4cf02f0e297429471ab95078820a48 (diff)
downloadgcc-37e47ee96393168103a35a792e40b3c808ebc192.zip
gcc-37e47ee96393168103a35a792e40b3c808ebc192.tar.gz
gcc-37e47ee96393168103a35a792e40b3c808ebc192.tar.bz2
re PR fortran/26779 (Internal module procedure may not have private type dummy arguments)
2006-03-28 Paul Thomas <pault@gcc.gnu.org> PR fortran/26779 *resolve.c (resolve_fl_procedure): Do not check the access of derived types for internal procedures. 2006-03-28 Paul Thomas <pault@gcc.gnu.org> PR fortran/26779 * gfortran.dg/private_type_5.f90: New test. From-SVN: r112442
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/resolve.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/private_type_5.f9024
4 files changed, 42 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 6d19805..d2a1e4f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-28 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/26779
+ *resolve.c (resolve_fl_procedure): Do not check the access of
+ derived types for internal procedures.
+
2006-03-27 Jakub Jelinek <jakub@redhat.com>
* io.c (check_io_constraints): Don't look at
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 548b67e..562338f 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -4834,9 +4834,13 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
}
}
- /* Ensure that derived type formal arguments of a public procedure
- are not of a private type. */
- if (gfc_check_access(sym->attr.access, sym->ns->default_access))
+ /* Ensure that derived type for are not of a private type. Internal
+ module procedures are excluded by 2.2.3.3 - ie. they are not
+ externally accessible and can access all the objects accesible in
+ the host. */
+ if (!(sym->ns->parent
+ && sym->ns->parent->proc_name->attr.flavor == FL_MODULE)
+ && gfc_check_access(sym->attr.access, sym->ns->default_access))
{
for (arg = sym->formal; arg; arg = arg->next)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 539c2a8..c2383d2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-03-28 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/26779
+ * gfortran.dg/private_type_5.f90: New test.
+
2006-03-27 David Edelsohn <edelsohn@gnu.org>
* objc.dg/objc-nofilename-1.m: Limit to Darwin.
diff --git a/gcc/testsuite/gfortran.dg/private_type_5.f90 b/gcc/testsuite/gfortran.dg/private_type_5.f90
new file mode 100644
index 0000000..e62fe6e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/private_type_5.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! Tests the fix for PR26779, where an error would occur because
+! init was detected to be public with a private type dummy argument.
+!
+! Contributed by Paul Thomas <pault@gcc.gnu.org>
+!
+module test
+ public sub
+ type, private :: t
+ integer :: i
+ end type t
+contains
+ subroutine sub (arg)
+ integer arg
+ type(t) :: root
+ call init(root, arg)
+ contains
+ subroutine init(ir, i)
+ integer i
+ type(t) :: ir
+ ir%i = i
+ end subroutine init
+ end subroutine sub
+end module test \ No newline at end of file