[Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
--- Comment #5 from burnus at gcc dot gnu dot org 2006-10-30 14:17 --- Subject: Bug 29452 Author: burnus Date: Mon Oct 30 14:17:15 2006 New Revision: 118184 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=118184 Log: fortran/ 2006-10-26 Tobias Burnus [EMAIL PROTECTED] PR fortran/29452 * io.c (check_io_constraints): Fix keyword string comparison. libgfortran/ 2006-10-26 Tobias Burnus [EMAIL PROTECTED] PR fortran/29452 * runtime/string.c (compare0): Check whether string lengths match. testsuite/ 2006-10-26 Tobias Burnus [EMAIL PROTECTED] PR fortran/29452 * gfortran.dg/write_check.f90: Check run-time keyword checking. * gfortran.dg/write_check2.f90: Check compile-time keyword checking. Added: branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/write_check.f90 branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/write_check2.f90 Modified: branches/gcc-4_2-branch/gcc/fortran/ChangeLog branches/gcc-4_2-branch/gcc/fortran/io.c branches/gcc-4_2-branch/gcc/testsuite/ChangeLog branches/gcc-4_2-branch/libgfortran/ChangeLog branches/gcc-4_2-branch/libgfortran/runtime/string.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452
[Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
--- Comment #6 from burnus at gcc dot gnu dot org 2006-10-30 14:19 --- Accept bug -- burnus at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |burnus at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2006-10-22 07:15:24 |2006-10-30 14:19:57 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452
[Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
--- Comment #7 from burnus at gcc dot gnu dot org 2006-10-30 14:21 --- And mark as fixed. Hopefully, we won't forget to add checks also to the following specifiers as soon as we implement them. WRITE/READ (some only in READ allowed; those are not yet implemented in gfortran): - ASYNCHRONOUS: 'YES', 'NO' - BLANK: 'NULL', 'ZERO' - DECIMAL: 'COMMA', 'POINT' - DELIM: 'APOSTROPHE', 'QUOTE', 'NONE - PAD: 'YES', 'NO' - ROUND: 'UP', 'DOWN', 'ZERO', 'NEAREST', 'COMPATIBLE'. 'PROCESSOR_DEFINED' - SIGN: PLUS, SUPPRESS, PROCESSOR_DEFINED -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452
[Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
--- Comment #4 from patchapp at dberlin dot org 2006-10-26 08:27 --- Subject: Bug number PR29452 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01327.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452
[Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
--- Comment #3 from fxcoudert at gcc dot gnu dot org 2006-10-22 07:15 --- (In reply to comment #1) - A compile-time-error is shown (probably fixed by FX patch, not checked) Yes, it's fixed by my patch. Confirming this bug. Tobias, if you want to submit a global patch to resolve these issues (both compile-time and run-time), I'll be happy to review it. 4.3 is in stage 1, it's time for change! :) PS: for the compile-time checks, you can probably use the compare_to_allowed helper routine I added in my OPEN/CLOSE checks patch; most of the work is probably reading both F95 and F2003 to spot the differences. -- fxcoudert at gcc dot gnu dot org changed: What|Removed |Added CC||fxcoudert at gcc dot gnu dot ||org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2006-10-22 07:15:24 date|| Target Milestone|--- |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452
[Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
--- Comment #2 from tobias dot burnus at physik dot fu-berlin dot de 2006-10-17 15:31 --- The library problems are due to an error in the string comparison; one only compares the first (fortran string length) characters, but never checks whether the strings are of identical length. Patch: Index: libgfortran/runtime/string.c === --- libgfortran/runtime/string.c(revision 117796) +++ libgfortran/runtime/string.c(working copy) @@ -44,6 +44,7 @@ /* Strip trailing blanks from the Fortran string. */ len = fstrlen (s1, s1_len); + if(len != strlen(s2)) return 0; /* don't match */ return strncasecmp (s1, s2, len) == 0; } Similarly for WRITE(*,*,ADVANCE='YES/NO'): Index: gcc/fortran/io.c === --- gcc/fortran/io.c(revision 117796) +++ gcc/fortran/io.c(working copy) @@ -2697,8 +2697,8 @@ if (expr-expr_type == EXPR_CONSTANT expr-ts.type == BT_CHARACTER) { const char * advance = expr-value.character.string; - not_no = strncasecmp (advance, no, 2) != 0; - not_yes = strncasecmp (advance, yes, 2) != 0; + not_no = strcasecmp (advance, no) != 0; + not_yes = strcasecmp (advance, yes) != 0; } else { I will submit a patch in the next days. (The other suggested checks for READ/WRITE are not yet needed as those options are not supported, yet. I don't know in how far strcasencmp problems occurre at other places as well.) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452
[Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
--- Comment #1 from tobias dot burnus at physik dot fu-berlin dot de 2006-10-13 10:13 --- Some tests show: open(13,file='foo',form='format') close(13,status='del') compiles and runs in gfortran. Expected: - A run-time error is shown. - A compile-time-error is shown (probably fixed by FX patch, not checked) * * * write(13,'(a)',advance='N') 'Hello:' This gives a compile-time error, whereas str = 'N' write(13,'(a)',advance=str) 'Hello:' gives not a run-time error. write(13,'(a)',advance='Not') 'Hello:' gives no compile-time error, but a run-time error. -- tobias dot burnus at physik dot fu-berlin dot de changed: What|Removed |Added Summary|Do compile-time specifier |Keyword check for specifiers |checks for WRITE and READ |in WRITE, READ and ||OPEN/CLOSE http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452