Commit f3ad8745 by Janus Weil

re PR fortran/84409 ([F03] check DTIO arguments for character len)

2018-02-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/84409
	* interface.c (check_dtio_arg_TKR_intent): Add a check for character
	length.


2018-02-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/84409
	* gfortran.dg/dtio_21.f03: Add an error message.
	* gfortran.dg/dtio_22.f90: Fix invalid test case.

From-SVN: r257711
parent 51f174c0
2018-02-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/84409
* interface.c (check_dtio_arg_TKR_intent): Add a check for character
length.
2018-02-14 Janus Weil <janus@gcc.gnu.org> 2018-02-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/84385 PR fortran/84385
......
...@@ -4673,7 +4673,7 @@ gfc_check_typebound_override (gfc_symtree* proc, gfc_symtree* old) ...@@ -4673,7 +4673,7 @@ gfc_check_typebound_override (gfc_symtree* proc, gfc_symtree* old)
/* The following three functions check that the formal arguments /* The following three functions check that the formal arguments
of user defined derived type IO procedures are compliant with of user defined derived type IO procedures are compliant with
the requirements of the standard. */ the requirements of the standard, see F03:9.5.3.7.2 (F08:9.6.4.8.3). */
static void static void
check_dtio_arg_TKR_intent (gfc_symbol *fsym, bool typebound, bt type, check_dtio_arg_TKR_intent (gfc_symbol *fsym, bool typebound, bt type,
...@@ -4702,6 +4702,10 @@ check_dtio_arg_TKR_intent (gfc_symbol *fsym, bool typebound, bt type, ...@@ -4702,6 +4702,10 @@ check_dtio_arg_TKR_intent (gfc_symbol *fsym, bool typebound, bt type,
gfc_error ("DTIO dummy argument at %L must be an " gfc_error ("DTIO dummy argument at %L must be an "
"ASSUMED SHAPE ARRAY", &fsym->declared_at); "ASSUMED SHAPE ARRAY", &fsym->declared_at);
if (type == BT_CHARACTER && fsym->ts.u.cl->length != NULL)
gfc_error ("DTIO character argument at %L must have assumed length",
&fsym->declared_at);
if (fsym->attr.intent != intent) if (fsym->attr.intent != intent)
gfc_error ("DTIO dummy argument at %L must have INTENT %s", gfc_error ("DTIO dummy argument at %L must have INTENT %s",
&fsym->declared_at, gfc_code2string (intents, (int)intent)); &fsym->declared_at, gfc_code2string (intents, (int)intent));
......
2018-02-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/84409
* gfortran.dg/dtio_21.f03: Add an error message.
* gfortran.dg/dtio_22.f90: Fix invalid test case.
2018-02-15 Thomas Koenig <tkoenig@gcc.gnu.org> 2018-02-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/84381 PR fortran/84381
......
...@@ -19,10 +19,10 @@ program p ...@@ -19,10 +19,10 @@ program p
allocate(z2) allocate(z2)
print *, z2 print *, z2
contains contains
subroutine wf2(this, a, b, c, d, e) subroutine wf2(this, a, b, c, d, e) ! { dg-error "must have assumed length" }
class(t2), intent(in) :: this class(t2), intent(in) :: this
integer, intent(in) :: a integer, intent(in) :: a
character, intent(in) :: b character(*), intent(in) :: b
integer, intent(in) :: c(:) integer, intent(in) :: c(:)
integer, intent(out) :: d integer, intent(out) :: d
character, intent(inout) :: e character, intent(inout) :: e
......
...@@ -15,10 +15,10 @@ contains ...@@ -15,10 +15,10 @@ contains
subroutine wf(this, unit, b, c, iostat, iomsg) subroutine wf(this, unit, b, c, iostat, iomsg)
class(t), intent(in) :: this class(t), intent(in) :: this
integer, intent(in) :: unit integer, intent(in) :: unit
character, intent(in) :: b character(*), intent(in) :: b
integer, intent(in) :: c(:) integer, intent(in) :: c(:)
integer, intent(out) :: iostat integer, intent(out) :: iostat
character, intent(inout) :: iomsg character(*), intent(inout) :: iomsg
write (unit, "(i3)", IOSTAT=iostat, IOMSG=iomsg) this%i write (unit, "(i3)", IOSTAT=iostat, IOMSG=iomsg) this%i
end subroutine end subroutine
end 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