aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrooks Moses <brooks.moses@codesourcery.com>2007-01-04 17:30:37 +0000
committerBrooks Moses <brooks@gcc.gnu.org>2007-01-04 09:30:37 -0800
commit3ab7b3def2c04c65ec4054bb4e540fb70b1012b0 (patch)
tree548e3afae25e554953647125e37c14825130cb42
parent5f9a37a64894dc717cf96c228454f510bc92efe5 (diff)
downloadgcc-3ab7b3def2c04c65ec4054bb4e540fb70b1012b0.zip
gcc-3ab7b3def2c04c65ec4054bb4e540fb70b1012b0.tar.gz
gcc-3ab7b3def2c04c65ec4054bb4e540fb70b1012b0.tar.bz2
re PR fortran/30235 ([4.1 only] missing alternate return argument with explicit interface causes segfault)
fortran/ PR 30235 * interface.c (compare_actual_formal): check for alternate returns when iterating over non-present arguments. testsuite/ PR 30235 * gfortran.dg/altreturn_2.f90: new test. From-SVN: r120447
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/interface.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rwxr-xr-xgcc/testsuite/gfortran.dg/altreturn_2.f908
4 files changed, 27 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ced91a8..2333b82 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,12 @@
2007-01-04 Brooks Moses <brooks.moses@codesourcery.com>
+ PR 30235
+ * interface.c (compare_actual_formal): check for
+ alternate returns when iterating over non-present
+ arguments.
+
+2007-01-04 Brooks Moses <brooks.moses@codesourcery.com>
+
* invoke.texi: Update manpage copyright to include 2007.
2007-01-04 Brooks Moses <brooks.moses@codesourcery.com>
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index dd1ac69..7b0c423 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1455,6 +1455,13 @@ compare_actual_formal (gfc_actual_arglist ** ap,
{
if (new[i] != NULL)
continue;
+ if (f->sym == NULL)
+ {
+ if (where)
+ gfc_error ("Missing alternate return spec in subroutine call at %L",
+ where);
+ return 0;
+ }
if (!f->sym->attr.optional)
{
if (where)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0663f79..0309fad 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-01-04 Brooks Moses <brooks.moses@codesourcery.com>
+
+ PR 30235
+ * gfortran.dg/altreturn_2.f90: new test.
+
2007-01-04 Tom Tromey <tromey@redhat.com>
PR preprocessor/28165:
diff --git a/gcc/testsuite/gfortran.dg/altreturn_2.f90 b/gcc/testsuite/gfortran.dg/altreturn_2.f90
new file mode 100755
index 0000000..d0556d0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/altreturn_2.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+ program altreturn_2
+ call foo() ! { dg-error "Missing alternate return" }
+ contains
+ subroutine foo(*)
+ return
+ end subroutine
+ end program