fortran/ChangeLog:
* io.c (check_format): Allow an optional comma
between descriptors.
libgfortran/ChangeLog:
* format.c (parse_format_list): Allow an optional comma
between descriptors.
testsuite/ChangeLog:
* comma_format_extension_[1234].f: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97919
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-04-09 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR fortran/13257
+ * io.c (check_format): Allow an optional comma
+ between descriptors.
+
2005-04-09 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* match.c (match_arithmetic_if): Remove gfc_ prefix and correct
format_item:
/* In this state, the next thing has to be a format item. */
t = format_lex ();
+format_item_1:
switch (t)
{
case FMT_POSINT:
goto syntax;
default:
- error = "Missing comma";
- goto syntax;
+ if (gfc_notify_std (GFC_STD_GNU, "Extension: Missing comma at %C")
+ == FAILURE)
+ return FAILURE;
+ goto format_item_1;
}
optional_comma:
+2005-04-09 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR fortran/13257
+ * comma_format_extension_[1234].f: New tests.
+
2005-04-09 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/tree-ssa/stdarg-1.c: New test.
--- /dev/null
+! { dg-do compile }
+! { dg-options "" }
+! test that the extension for a missing comma is accepted
+
+ subroutine mysub
+ dimension ibar(5)
+ write (3,1001) ( ibar(m), m = 1, 5 )
+
+ 1001 format (/5x,' ',i4' '/ )
+ return
+ end
--- /dev/null
+! { dg-do compile }
+! test that the extension for a missing comma is accepted
+
+ subroutine mysub
+ dimension ibar(5)
+ write (3,1001) ( ibar(m), m = 1, 5 )
+
+ 1001 format (/5x,' ',i4' '/ ) ! { dg-warning "Missing comma" }
+ return
+ end
--- /dev/null
+! PR libfortran/15332 and PR fortran/13257
+! We used to accept this as an extension but
+! did do the correct thing at runtime.
+! Note the missing , before i1 in the format.
+! { do-do run }
+! { dg-options "" }
+ character*12 c
+
+ write (c,100) 0, 1
+ if (c .ne. 'i = 0, j = 1') call abort
+
+ write (c,100) 0
+ if (c .ne. 'i = 0 ') call abort
+
+ 100 format ('i = 'i1,:,', j = ',i1)
+ end
--- /dev/null
+! PR fortran/13257
+! Note the missing , before i1 in the format.
+! { do-do run }
+! { dg-options "" }
+ character*5 c
+ write (c,1001) 1
+ if (c .ne. ' 1 ') call abort
+
+ 1001 format (' ',i4' ')
+ end
+2005-04-09 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR fortran/13257
+ * format.c (parse_format_list): Allow an optional comma
+ between descriptors.
+
2005-04-08 Eric Botcazou <ebotcazou@libertysurf.fr>
* io/backspace.c (unformatted_backspace): Do not dereference
/* Get the next format item */
format_item:
t = format_lex ();
+ format_item_1:
switch (t)
{
case FMT_POSINT:
goto finished;
default:
- error = "Missing comma in format";
- goto finished;
+ /* Assume a missing comma, this is a GNU extension */
+ goto format_item_1;
}
/* Optional comma is a weird between state where we've just finished