aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2019-02-26 19:10:00 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2019-02-26 19:10:00 +0000
commite5bf8dee56aaf4c489a1f3ceca04a8fcd1d2665a (patch)
treed91a3ddd87b0b57de059fb05f1b7671cf07e82b1 /gcc/fortran
parent140a0bddcc12f14fcbc914e117ccf79cc6dd16cc (diff)
downloadgcc-e5bf8dee56aaf4c489a1f3ceca04a8fcd1d2665a.zip
gcc-e5bf8dee56aaf4c489a1f3ceca04a8fcd1d2665a.tar.gz
gcc-e5bf8dee56aaf4c489a1f3ceca04a8fcd1d2665a.tar.bz2
re PR fortran/89496 (gcc/fortran/trans-types.c:3015:9: runtime error: member access within null pointer of type 'struct gfc_formal_arglist')
2019-02-26 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/89496 * trans-types.c (get_formal_from_actual_arglist): If the actual arglist has no expression, the corresponding formal arglist is an alternate return. 2019-02-26 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/89496 * gfortran.dg/altreturn_9_0.f90: New file. * gfortran.dg/altreturn_9_1.f90: New file. From-SVN: r269226
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog9
-rw-r--r--gcc/fortran/trans-types.c5
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2293c9a..2646608 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2019-02-26 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/89496
+ * trans-types.c (get_formal_from_actual_arglist): If
+ the actual arglist has no expression, the corresponding
+ formal arglist is an alternate return.
+
2019-02-26 Jakub Jelinek <jakub@redhat.com>
PR fortran/43210
@@ -8,7 +15,7 @@
PR fortran/89174
* trans-expr.c (gfc_find_and_cut_at_last_class_ref): Add is_mold
- to garguments. If we are dealing with a MOLD, call
+ to arguments. If we are dealing with a MOLD, call
gfc_expr_to_initialize().
* trans-stmt.c (gfc_trans_allocate): For MOLD, pass is_mold=true
to gfc_find_and_cut_at_last_class_ref.
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 2115db2..58102ba 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2988,9 +2988,9 @@ get_formal_from_actual_arglist (gfc_symbol *sym, gfc_actual_arglist *actual_args
f = &sym->formal;
for (a = actual_args; a != NULL; a = a->next)
{
+ (*f) = gfc_get_formal_arglist ();
if (a->expr)
{
- (*f) = gfc_get_formal_arglist ();
snprintf (name, GFC_MAX_SYMBOL_LEN, "_formal_%d", var_num ++);
gfc_get_symbol (name, NULL, &s);
if (a->expr->ts.type == BT_PROCEDURE)
@@ -3012,6 +3012,9 @@ get_formal_from_actual_arglist (gfc_symbol *sym, gfc_actual_arglist *actual_args
s->attr.intent = INTENT_UNKNOWN;
(*f)->sym = s;
}
+ else /* If a->expr is NULL, this is an alternate rerturn. */
+ (*f)->sym = NULL;
+
f = &((*f)->next);
}
}