token = FMT_END;
break;
}
+ if (c == '/')
+ {
+ token = FMT_SLASH;
+ break;
+ }
if (c == delim)
continue;
unget_char ();
}
}
}
+ else if (c == '/')
+ {
+ token = FMT_SLASH;
+ break;
+ }
else
unget_char ();
}
return false;
goto between_desc;
- case FMT_DT:
- t = format_lex ();
- if (t == FMT_ERROR)
- goto fail;
- switch (t)
- {
- case FMT_RPAREN:
- level--;
- if (level < 0)
- goto finished;
- goto between_desc;
-
- case FMT_COMMA:
- goto format_item;
-
- case FMT_LPAREN:
-
- dtio_vlist:
- t = format_lex ();
- if (t == FMT_ERROR)
- goto fail;
-
- if (t != FMT_POSINT)
- {
- error = posint_required;
- goto syntax;
- }
-
- t = format_lex ();
- if (t == FMT_ERROR)
- goto fail;
-
- if (t == FMT_COMMA)
- goto dtio_vlist;
- if (t != FMT_RPAREN)
- {
- error = _("Right parenthesis expected at %C");
- goto syntax;
- }
- goto between_desc;
-
- default:
- error = unexpected_element;
- goto syntax;
- }
-
- goto format_item;
-
case FMT_SIGN:
case FMT_BLANK:
case FMT_DP:
case FMT_A:
case FMT_D:
case FMT_H:
+ case FMT_DT:
goto data_desc;
case FMT_END:
break;
+ case FMT_DT:
+ t = format_lex ();
+ if (t == FMT_ERROR)
+ goto fail;
+ switch (t)
+ {
+ case FMT_RPAREN:
+ level--;
+ if (level < 0)
+ goto finished;
+ goto between_desc;
+
+ case FMT_COMMA:
+ goto format_item;
+
+ case FMT_LPAREN:
+
+ dtio_vlist:
+ t = format_lex ();
+ if (t == FMT_ERROR)
+ goto fail;
+
+ if (t != FMT_POSINT)
+ {
+ error = posint_required;
+ goto syntax;
+ }
+
+ t = format_lex ();
+ if (t == FMT_ERROR)
+ goto fail;
+
+ if (t == FMT_COMMA)
+ goto dtio_vlist;
+ if (t != FMT_RPAREN)
+ {
+ error = _("Right parenthesis expected at %C");
+ goto syntax;
+ }
+ goto between_desc;
+
+ default:
+ error = unexpected_element;
+ goto syntax;
+ }
+ break;
+
case FMT_F:
t = format_lex ();
if (t == FMT_ERROR)
--- /dev/null
+! { dg-do compile }
+! PR80484 Three syntax errors involving derived-type I/O
+module dt_write_mod
+ type, public :: B_type
+ real :: amount
+ end type B_type
+ interface write (formatted)
+ procedure :: Write_b
+ end interface
+contains
+
+subroutine Write_b &
+ (amount, unit, b_edit_descriptor, v_list, iostat, iomsg)
+
+ class (B_type), intent(in) :: amount
+ integer, intent(in) :: unit
+ character (len=*), intent(in) :: b_edit_descriptor
+ integer, dimension(:), intent(in) :: v_list
+ integer, intent(out) :: iostat
+ character (len=*), intent(inout) :: iomsg
+ write (unit=unit, fmt="(f9.3)", iostat=iostat) amount%amount
+
+end subroutine Write_b
+
+end module dt_write_mod
+
+program test
+ use dt_write_mod, only: B_type , write(formatted)
+ implicit none
+
+ real :: wage = 15.10
+ integer :: ios
+ character(len=99) :: iom = "OK"
+
+ write (unit=*, fmt="(DT'$$$Z.##')", iostat=ios, iomsg=iom) &
+ B_type(wage), B_type(wage)
+ print *, trim(iom)
+ write (unit=*, fmt="(2DT'$$$Z.##')", iostat=ios, iomsg=iom) &
+ B_type(wage), B_type(wage)
+ print *, trim(iom)
+ write (unit=*, fmt="(3DT'$$$Z.##')", iostat=ios, iomsg=iom) &
+ B_type(wage), B_type(wage)
+ print *, trim(iom)
+ write (unit=*, fmt="(DT'$$$Z.##'/)", iostat=ios, iomsg=iom) &
+ B_type(wage), B_type(wage)
+ print *, trim(iom)
+end program test