Commit 52354dad by Thomas König

Check for illegal reference in function.

parent 2589beb1
2020-01-19 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/44960
* primary.c (gfc_match_rvalue): Break after setting MATCH_ERROR.
* resolve.c (resolve_function): Issue error when a
function call contains a reference.
2020-01-17 Mark Eggleston <mark.eggleston@codethink.com>
PR fortran/93236
......
......@@ -3661,6 +3661,7 @@ gfc_match_rvalue (gfc_expr **result)
gfc_error ("The leftmost part-ref in a data-ref cannot be a "
"function reference at %C");
m = MATCH_ERROR;
break;
}
m = MATCH_YES;
......
......@@ -3129,6 +3129,13 @@ resolve_function (gfc_expr *expr)
|| sym->intmod_sym_id == GFC_ISYM_CAF_SEND))
return true;
if (expr->ref)
{
gfc_error ("Unexpected junk after %qs at %L", expr->symtree->n.sym->name,
&expr->where);
return false;
}
if (sym && sym->attr.intrinsic
&& !gfc_resolve_intrinsic (sym, &expr->where))
return false;
......
2020-01-19 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/44960
* gfortran.dg/function_reference_1.f90: New test.
* gfortran.dg/function_reference_2.f90: New test.
2020-01-18 Jakub Jelinek <jakub@redhat.com>
PR c/92833
......
! { dg-do compile }
! PR 44960 - this was erroneusly accepted.
! Original test case by Daniel Franke.
type t
integer :: a
end type t
type(t) :: foo
print *, foo(1)%a ! { dg-error "Unexpected junk" }
end
! { dg-do compile }
! PR 44960 - improve the error message
program main
type t
integer :: a
end type t
type(t) :: foo
external foo
i = foo(1)%1 ! { dg-error "leftmost part-ref in a data-ref cannot be a function reference" }
end
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