[Bug fortran/69456] Namelist value with trailing sign is ignored without error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69456 Jerry DeLisle changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #9 from Jerry DeLisle --- Fixed on trunk. Closing
[Bug fortran/69456] Namelist value with trailing sign is ignored without error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69456 --- Comment #8 from Jerry DeLisle --- Fixed on trunk. Will leave open for a bit to see if there is any fallout.
[Bug fortran/69456] Namelist value with trailing sign is ignored without error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69456 --- Comment #7 from Jerry DeLisle --- Author: jvdelisle Date: Tue Feb 23 18:38:31 2016 New Revision: 233641 URL: https://gcc.gnu.org/viewcvs?rev=233641=gcc=rev Log: 2016-02-23 Jerry DeLislePR libgfortran/69456 * io/list_read.c (read_real): If digit is missing from exponent issue an error. (parse_real): Likewise and adjusted error message to clarify it is part of a complex number. (nml_read_obj): Bump item count and add comment that this is used to identify which item in a namelist read has a problem. PR libgfortran/69456 * gfortran.dg/namelist_89.f90: New test. * gfortran.dg/pr59700.f90: Update test.. Added: trunk/gcc/testsuite/gfortran.dg/namelist_89.f90 Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/pr59700.f90 trunk/libgfortran/ChangeLog trunk/libgfortran/io/list_read.c
[Bug fortran/69456] Namelist value with trailing sign is ignored without error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69456 --- Comment #6 from Jerry DeLisle --- Created attachment 37707 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37707=edit A patch to fix this. This patch enables the error message. It regression tests OK.
[Bug fortran/69456] Namelist value with trailing sign is ignored without error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69456 --- Comment #5 from Jerry DeLisle --- From the Fortran 95 Standard regarding exponents. The basic form may be followed by an exponent of one of the following forms: (1) A sign followed by a digit-string (2) E followed by zero or more blanks, followed by a signed-digit-string (3) D followed by zero or more blanks, followed by a signed-digit-string An exponent containing a D is processed identically to an exponent containing an E. Form (1) allows the following in the test case of this report: r3=1+1" ! Treated as 1e+1? Yes this is valid r4=1-1" ! Treated as 1e-1? Yes this is valid That being clarified, the first two examples are invalid because the required digit-string must contain at least one digit. r1=1+"! BUG: wrong result: Agreed an error may be helpful r2=1-"! BUG: wrong result: Agreed an error may be helpful In fact the last two cases here do result in a "bad_real" in read_real, however, it is being interpreted as a NULL value. I have further work to do. Keep in mind that it is users responsibility to use correct input data.
[Bug fortran/69456] Namelist value with trailing sign is ignored without error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69456 Jerry DeLisle changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |jvdelisle at gcc dot gnu.org --- Comment #4 from Jerry DeLisle --- I will take this one.
[Bug fortran/69456] Namelist value with trailing sign is ignored without error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69456 --- Comment #2 from kargl at gcc dot gnu.org --- (In reply to Josiah Schwab from comment #0) > > I read the code for the function parse_real in libgfortran/io/list_read.c > and this behavior appears to exist because the value '1+1' is permitted as a > shorthand for '1e+1'. This was also surprising to me. > > I read the Fortran 2008 specification. I had difficulty fully understanding > it, but I failed to find a place where it said that exponent-letter can be > legally omitted. A look at the list of gfortran vendor extensions as well > as a web search also failed to provide additional information. > > See Table 10.1, "E and D Exponent Forms" in Fortran 2008 standard.
[Bug fortran/69456] Namelist value with trailing sign is ignored without error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69456 Dominique d'Humieres changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2016-01-24 CC||jvdelisle at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Dominique d'Humieres --- Confirmed from 4.8 up to trunk (6.0).
[Bug fortran/69456] Namelist value with trailing sign is ignored without error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69456 --- Comment #3 from Josiah Schwab --- (In reply to kargl from comment #2) > (In reply to Josiah Schwab from comment #0) > > > > I read the code for the function parse_real in libgfortran/io/list_read.c > > and this behavior appears to exist because the value '1+1' is permitted as a > > shorthand for '1e+1'. This was also surprising to me. > > > > I read the Fortran 2008 specification. I had difficulty fully understanding > > it, but I failed to find a place where it said that exponent-letter can be > > legally omitted. A look at the list of gfortran vendor extensions as well > > as a web search also failed to provide additional information. > > > > > > See Table 10.1, "E and D Exponent Forms" in Fortran 2008 standard. Thank you. If I understand correctly, that makes it clear that r3 & r4 in my example do conform to the standard. The behavior of r1 & r2 still seems wrong. (But I am very inexperienced at reading standards, so please do correct me.)