Commit 8f9c06ca by Tobias Schlüter Committed by Tobias Schlüter

re PR fortran/20323 (optional arguments incorrectly accepted in specification expressions)

fortran/
PR fortran/20323
* resolve.c (gfc_resolve): Check if character lengths are
specification expressions.

testsuite/
PR fortran/20323
* gfortran.dg/spec_expr_1.f90: New test.

From-SVN: r96382
parent 08cee789
2005-03-13 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/20323
* resolve.c (gfc_resolve): Check if character lengths are
specification expressions.
2005-03-12 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/20361
......
......@@ -4749,10 +4749,11 @@ gfc_resolve (gfc_namespace * ns)
if (cl->length == NULL || gfc_resolve_expr (cl->length) == FAILURE)
continue;
if (cl->length->ts.type != BT_INTEGER)
gfc_error
("Character length specification at %L must be of type INTEGER",
&cl->length->where);
if (gfc_simplify_expr (cl->length, 0) == FAILURE)
continue;
if (gfc_specification_expr (cl->length) == FAILURE)
continue;
}
gfc_traverse_ns (ns, resolve_values);
......
2005-03-13 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/20323
* gfortran.dg/spec_expr_1.f90: New test.
2005-03-13 Joseph S. Myers <joseph@codesourcery.com>
PR c/20402
......
! { dg-do compile }
! PR 20323
! We didn't verify that character length expressions are specification
! expressions.
function testpresent(arg)
integer, intent(in), optional :: arg
character(len=arg) :: s ! { dg-error "OPTIONAL" }
logical :: testpresent
testpresent=.true.
end function testpresent
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