Commit 866664a3 by Thomas Koenig

re PR fortran/78865 (ICE in create_tmp_var, at gimple-expr.c:473)

2019-03-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/78865
	* interface.c (compare_actual_formal): Change errors about
	missing or extra to gfc_error_now to make sure they are issued.
	Change "spec" to "specifier" in message.
	* resolve.c (resolve_global_procedure): Also check for mismatching
	interface with global symbols if the namespace has already been
	resolved.

2019-03-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/78865
	* gfortran.dg/altreturn_10.f90: New test.
	* gfortran.dg/whole_file_3.f90: Change dg-warning to dg-error.

From-SVN: r269895
parent c1e62ea1
2019-03-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/78865
* interface.c (compare_actual_formal): Change errors about
missing or extra to gfc_error_now to make sure they are issued.
Change "spec" to "specifier" in message.
* resolve.c (resolve_global_procedure): Also check for mismatching
interface with global symbols if the namespace has already been
resolved.
2019-03-21 Thomas Schwinge <thomas@codesourcery.com>
PR fortran/72741
......
......@@ -2969,17 +2969,19 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
if (f->sym == NULL)
{
/* These errors have to be issued, otherwise an ICE can occur.
See PR 78865. */
if (where)
gfc_error ("Missing alternate return spec in subroutine call "
"at %L", where);
gfc_error_now ("Missing alternate return specifier in subroutine "
"call at %L", where);
return false;
}
if (a->expr == NULL)
{
if (where)
gfc_error ("Unexpected alternate return spec in subroutine "
"call at %L", where);
gfc_error_now ("Unexpected alternate return specifier in "
"subroutine call at %L", where);
return false;
}
......
......@@ -2498,20 +2498,23 @@ resolve_global_procedure (gfc_symbol *sym, locus *where,
&& gsym->type != GSYM_UNKNOWN
&& !gsym->binding_label
&& gsym->ns
&& gsym->ns->resolved != -1
&& gsym->ns->proc_name
&& not_in_recursive (sym, gsym->ns)
&& not_entry_self_reference (sym, gsym->ns))
{
gfc_symbol *def_sym;
def_sym = gsym->ns->proc_name;
if (gsym->ns->resolved != -1)
{
/* Resolve the gsymbol namespace if needed. */
if (!gsym->ns->resolved)
{
gfc_symbol *old_dt_list;
/* Stash away derived types so that the backend_decls do not
get mixed up. */
/* Stash away derived types so that the backend_decls
do not get mixed up. */
old_dt_list = gfc_derived_types;
gfc_derived_types = NULL;
......@@ -2539,8 +2542,6 @@ resolve_global_procedure (gfc_symbol *sym, locus *where,
}
}
def_sym = gsym->ns->proc_name;
/* This can happen if a binding name has been specified. */
if (gsym->binding_label && gsym->sym_name != def_sym->name)
gfc_find_symbol (gsym->sym_name, gsym->ns, 0, &def_sym);
......@@ -2555,6 +2556,7 @@ resolve_global_procedure (gfc_symbol *sym, locus *where,
break;
}
}
}
if (sym->attr.function && !gfc_compare_types (&sym->ts, &def_sym->ts))
{
......
2019-03-24 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/78865
* interface.c (compare_actual_formal): Change errors about
missing or extra to gfc_error_now to make sure they are issued.
Change "spec" to "specifier" in message.
* resolve.c (resolve_global_procedure): Also check for mismatching
interface with global symbols if the namespace has already been
resolved.
2019-03-22 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/89676
......
! { dg-do compile }
! { dg-options -Os }
! PR 78865 - this used to ICE.
program p
call sub (3)
end
subroutine sub (x)
integer :: x, i, n
do i = 1, x
if ( n /= 0 ) stop
call sub2
end do
print *, x, n
end
subroutine sub2
call sub (*99) ! { dg-error "Unexpected alternate return specifier" }
call sub (99.) ! { dg-warning "Type mismatch in argument" }
99 stop
end
......@@ -14,8 +14,8 @@
program test
EXTERNAL R
call PHLOAD (R, 1) ! { dg-warning "Missing alternate return spec" }
CALL PHLOAD (R, 2) ! { dg-warning "Missing alternate return spec" }
call PHLOAD (R, 1) ! { dg-error "Missing alternate return specifier" }
CALL PHLOAD (R, 2) ! { dg-error "Missing alternate return specifier" }
CALL PHLOAD (R, *999) ! This one is OK
999 continue
END program test
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment