public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/101627] New: List-directed read with trailing characters after quotes
@ 2021-07-26 17:08 hj8758558 at gmail dot com
2021-07-28 23:12 ` [Bug fortran/101627] " kargl at gcc dot gnu.org
2021-07-29 16:34 ` kargl at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: hj8758558 at gmail dot com @ 2021-07-26 17:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101627
Bug ID: 101627
Summary: List-directed read with trailing characters after
quotes
Product: gcc
Version: 11.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: hj8758558 at gmail dot com
Target Milestone: ---
When reading a string delimited by single quotes, but followed by a non-blank
character, gfortran takes the "err" branch. This is in contrast to ifort,
nagfor, and flang, which read the string within the quotes and ignore the
trailing character(s).
Is gfortran's behavior intended?
$ cat test.f90
program test
character(len=6) :: input_str = "'abc'a"
character(len=6) :: output_str
read (input_str, *, err=77) output_str
stop 'No read error'
77 continue
stop 'Read error'
end program test
$ gfortran test.f90 && ./a.out
STOP Read error
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/101627] List-directed read with trailing characters after quotes
2021-07-26 17:08 [Bug fortran/101627] New: List-directed read with trailing characters after quotes hj8758558 at gmail dot com
@ 2021-07-28 23:12 ` kargl at gcc dot gnu.org
2021-07-29 16:34 ` kargl at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-07-28 23:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101627
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #1 from kargl at gcc dot gnu.org ---
This might fix the issue, but I don't play in libgfortran very
often. Tried adding Jerry, but bugzilla did not like his addresses.
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 8cc7ddbe8e2..e9a628f234f 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -1189,6 +1189,7 @@ read_character (st_parameter_dt *dtp, int length
__attribute__ ((unused)))
if ((c = next_char (dtp)) == EOF)
goto eof;
+
switch (c)
{
CASE_SEPARATORS:
@@ -1233,7 +1234,6 @@ read_character (st_parameter_dt *dtp, int length
__attribute__ ((unused)))
break;
}
- unget_char (dtp, c);
goto done;
CASE_SEPARATORS:
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/101627] List-directed read with trailing characters after quotes
2021-07-26 17:08 [Bug fortran/101627] New: List-directed read with trailing characters after quotes hj8758558 at gmail dot com
2021-07-28 23:12 ` [Bug fortran/101627] " kargl at gcc dot gnu.org
@ 2021-07-29 16:34 ` kargl at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-07-29 16:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101627
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-07-29
Priority|P3 |P4
Ever confirmed|0 |1
--- Comment #2 from kargl at gcc dot gnu.org ---
Here a correct patch, which has been regression tested.
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 8cc7ddbe8e2..b551f2b9843 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -1258,7 +1258,7 @@ read_character (st_parameter_dt *dtp, int length
__attribute__ ((unused)))
done:
c = next_char (dtp);
done_eof:
- if (is_separator (c) || c == EOF)
+ if (quote == '"' || quote == '\'' || is_separator (c) || c == EOF)
{
unget_char (dtp, c);
eat_separator (dtp);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-29 16:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 17:08 [Bug fortran/101627] New: List-directed read with trailing characters after quotes hj8758558 at gmail dot com
2021-07-28 23:12 ` [Bug fortran/101627] " kargl at gcc dot gnu.org
2021-07-29 16:34 ` kargl at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).