diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2016-11-23 21:44:05 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2016-11-23 21:44:05 +0000 |
commit | 91c9fb42c0c9121b745779bb86e7ac6dae4363b7 (patch) | |
tree | 6684ceaad7db16f2228d91e4df625a593c89cf41 /gcc/fortran/trans-common.c | |
parent | 15a3cdd8b070651c9b5b3433bfaa0d7418a40460 (diff) | |
download | gcc-91c9fb42c0c9121b745779bb86e7ac6dae4363b7.zip gcc-91c9fb42c0c9121b745779bb86e7ac6dae4363b7.tar.gz gcc-91c9fb42c0c9121b745779bb86e7ac6dae4363b7.tar.bz2 |
re PR fortran/78297 (ICE in finish_equivalences, at fortran/trans-common.c:1246)
2016-11-23 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/78297
* trans-common.c (finish_equivalences): Do not dereference a NULL pointer.
2016-11-23 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/78297
* gfortran.dg/pr78297.f90: New test.
From-SVN: r242802
Diffstat (limited to 'gcc/fortran/trans-common.c')
-rw-r--r-- | gcc/fortran/trans-common.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c index 3207105..7706809 100644 --- a/gcc/fortran/trans-common.c +++ b/gcc/fortran/trans-common.c @@ -1246,8 +1246,12 @@ finish_equivalences (gfc_namespace *ns) { c = gfc_get_common_head (); /* We've lost the real location, so use the location of the - enclosing procedure. */ - c->where = ns->proc_name->declared_at; + enclosing procedure. If we're in a BLOCK DATA block, then + use the location in the sym_root. */ + if (ns->proc_name) + c->where = ns->proc_name->declared_at; + else if (ns->is_block_data) + c->where = ns->sym_root->n.sym->declared_at; strcpy (c->name, z->module); } else |