This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, libfortran] PR33253 namelist: reading back a string with apostrophe


Jerry DeLisle wrote:
FX Coudert wrote:
In addition, this patch adjusts the conditions that allow extended reads of namelists. This now requires -std=legacy. The reason is that all these cases with non standard namelists such as extra data or no delimiters end up conflicting. The mechanism for handling these is present, its a matter of choice when to allow what.

Short of a proper review, which I might do later this week, I want to note that as this requires users to turn change compiler options for their (broken) code, this should probably be noted in the release notes.


FX

I agree. Another thing that would be helpful is to see how other compilers handle the test cases given. I only have ifort.

ifort fails on namelist_15.f90 but passes on namelist_24.f90 with no compiler options.

Any comment on the behavior we want would be appreciated.

Jerry


Fx,


After some additional study on this one, we are able to fix everything without changing the require compiler options. The following patch does it. Addition of one more test for the bail out logic.

Index: list_read.c
===================================================================
--- list_read.c (revision 128954)
+++ list_read.c (working copy)
@@ -893,7 +893,10 @@ read_character (st_parameter_dt *dtp, in
       goto get_string;

     default:
-      if (dtp->u.p.namelist_mode)
+      if (dtp->u.p.namelist_mode
+         && (dtp->u.p.current_unit->flags.delim == DELIM_APOSTROPHE
+             || dtp->u.p.current_unit->flags.delim == DELIM_QUOTE
+             || quote == ' '))
        {
          unget_char (dtp,c);
          return;

OK for trunk? Test cases remain the same except no -std=legacy for namelist_24.f90

Jerry


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]