summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-29 02:34:11 +0000
committerpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-29 02:34:11 +0000
commit5cb9d0d850f8e082972dbacacf5b92740e5915b2 (patch)
treef55b04a0462d8b524931c5473322c4b7989f8482
parent126a70bb7a096f3e70127132de2b1fa8d0010685 (diff)
downloadppe42-gcc-5cb9d0d850f8e082972dbacacf5b92740e5915b2.tar.gz
ppe42-gcc-5cb9d0d850f8e082972dbacacf5b92740e5915b2.zip
2005-04-29 Paul Brook <paul@codesourcery.com>
* trans-expr.c (gfc_conv_expr_present): Fix broken assert. Update comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98968 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/trans-expr.c5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gfortran.dg/entry_3.f9025
4 files changed, 37 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 7ef40e0cdae..9857aee7324 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2005-04-29 Paul Brook <paul@codesourcery.com>
+
+ * trans-expr.c (gfc_conv_expr_present): Fix broken assert. Update
+ comment.
+
2005-04-29 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.h (gfc_namespace): Add seen_implicit_none field.
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 2db5fbdc7bb..58a0d6e1494 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -115,14 +115,15 @@ gfc_make_safe_expr (gfc_se * se)
}
-/* Return an expression which determines if a dummy parameter is present. */
+/* Return an expression which determines if a dummy parameter is present.
+ Also used for arguments to procedures with multiple entry points. */
tree
gfc_conv_expr_present (gfc_symbol * sym)
{
tree decl;
- gcc_assert (sym->attr.dummy && sym->attr.optional);
+ gcc_assert (sym->attr.dummy);
decl = gfc_get_symbol_decl (sym);
if (TREE_CODE (decl) != PARM_DECL)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0ab6998a33a..eddf8c94100 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2005-04-29 Paul Brook <paul@codesourcery.com>
+
+ * gfortran.dg/entry_3.f90: New test.
+
2005-04-29 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.dg/implicit_4.f90: New test.
diff --git a/gcc/testsuite/gfortran.dg/entry_3.f90 b/gcc/testsuite/gfortran.dg/entry_3.f90
new file mode 100644
index 00000000000..36595ee31e1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/entry_3.f90
@@ -0,0 +1,25 @@
+! { dg-do run }
+! Test assumed shape arrays in procedures with multiple entry points.
+! Arguments that aren't present in all entry points must be treated like
+! optional arguments.
+module entry_4
+contains
+subroutine foo(a)
+ integer, dimension(:) :: a
+ integer, dimension(:) :: b
+ a = (/1, 2/)
+ return
+entry bar(b)
+ b = (/3, 4/)
+end subroutine
+end module
+
+program entry_4_prog
+ use entry_4
+ integer :: a(2)
+ a = 0
+ call foo(a)
+ if (any (a .ne. (/1, 2/))) call abort
+ call bar(a)
+ if (any (a .ne. (/3, 4/))) call abort
+end program
OpenPOWER on IntegriCloud