summaryrefslogtreecommitdiff
path: root/libgfortran/io/format.c
diff options
context:
space:
mode:
authorrus <rus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-09 20:58:24 +0000
committerrus <rus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-09 20:58:24 +0000
commit7f4db7c80779ecbc57d1146654daf0acfe18de66 (patch)
tree3af522a3b5e149c3fd498ecb1255994daae2129a /libgfortran/io/format.c
parent611349f0ec42a37591db2cd02974a11a48d10edb (diff)
downloadgcc-profile-stdlib.tar.gz
merge from trunkprofile-stdlib
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/profile-stdlib@154052 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io/format.c')
-rw-r--r--libgfortran/io/format.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c
index 4ab70e8c3ad..cafea8732e4 100644
--- a/libgfortran/io/format.c
+++ b/libgfortran/io/format.c
@@ -29,6 +29,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
* interpretation during I/O statements */
#include "io.h"
+#include "format.h"
#include <ctype.h>
#include <string.h>
#include <stdbool.h>
@@ -706,6 +707,13 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok)
goto data_desc;
}
+ if (t != FMT_COMMA && t != FMT_RPAREN && t != FMT_SLASH
+ && t != FMT_POSINT)
+ {
+ fmt->error = "Comma required after P descriptor";
+ goto finished;
+ }
+
fmt->saved_token = t;
goto optional_comma;
@@ -734,7 +742,7 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok)
goto between_desc;
case FMT_STRING:
- /* TODO: Find out why is is necessary to turn off format caching. */
+ /* TODO: Find out why it is necessary to turn off format caching. */
saveit = false;
get_fnode (fmt, &head, &tail, FMT_STRING);
tail->u.string.p = fmt->string;
@@ -851,19 +859,6 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok)
data_desc:
switch (t)
{
- case FMT_P:
- t = format_lex (fmt);
- if (t == FMT_POSINT)
- {
- fmt->error = "Repeat count cannot follow P descriptor";
- goto finished;
- }
-
- fmt->saved_token = t;
- get_fnode (fmt, &head, &tail, FMT_P);
-
- goto optional_comma;
-
case FMT_L:
t = format_lex (fmt);
if (t != FMT_POSINT)
@@ -940,7 +935,7 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok)
tail->u.real.d = fmt->value;
break;
}
- if (t == FMT_F || dtp->u.p.mode == WRITING)
+ if (t == FMT_F && dtp->u.p.mode == WRITING)
{
if (u != FMT_POSINT && u != FMT_ZERO)
{
@@ -948,13 +943,10 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok)
goto finished;
}
}
- else
+ else if (u != FMT_POSINT)
{
- if (u != FMT_POSINT)
- {
- fmt->error = posint_required;
- goto finished;
- }
+ fmt->error = posint_required;
+ goto finished;
}
tail->u.real.w = fmt->value;
@@ -971,6 +963,7 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok)
}
fmt->saved_token = t;
tail->u.real.d = 0;
+ tail->u.real.e = -1;
break;
}
@@ -982,11 +975,11 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok)
}
tail->u.real.d = fmt->value;
+ tail->u.real.e = -1;
- if (t == FMT_D || t == FMT_F)
+ if (t2 == FMT_D || t2 == FMT_F)
break;
- tail->u.real.e = -1;
/* Look for optional exponent */
t = format_lex (fmt);