public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/29452]  New: Do compile-time specifier checks for WRITE and READ
@ 2006-10-13 10:01 tobias dot burnus at physik dot fu-berlin dot de
  2006-10-13 10:13 ` [Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE tobias dot burnus at physik dot fu-berlin dot de
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: tobias dot burnus at physik dot fu-berlin dot de @ 2006-10-13 10:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/ml/fortran/2006-10/msg00241.html adds compile-time checking
for the specifier arguments of CLOSE and OPEN.

This should be done analogously for
(cf. 9.5.1 in Fortran 2003)

WRITE/READ (some only in READ allowed; some sre not yet implemented in
gfortran):
- ADVANCE: 'YES', 'NO'
- 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


-- 
           Summary: Do compile-time specifier checks for WRITE and READ
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tobias dot burnus at physik dot fu-berlin dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
  2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
@ 2006-10-13 10:13 ` tobias dot burnus at physik dot fu-berlin dot de
  2006-10-17 15:31 ` tobias dot burnus at physik dot fu-berlin dot de
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: tobias dot burnus at physik dot fu-berlin dot de @ 2006-10-13 10:13 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
  2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
  2006-10-13 10:13 ` [Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE tobias dot burnus at physik dot fu-berlin dot de
@ 2006-10-17 15:31 ` tobias dot burnus at physik dot fu-berlin dot de
  2006-10-22  7:15 ` fxcoudert at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: tobias dot burnus at physik dot fu-berlin dot de @ 2006-10-17 15:31 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
  2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
  2006-10-13 10:13 ` [Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE tobias dot burnus at physik dot fu-berlin dot de
  2006-10-17 15:31 ` tobias dot burnus at physik dot fu-berlin dot de
@ 2006-10-22  7:15 ` fxcoudert at gcc dot gnu dot org
  2006-10-26  8:28 ` patchapp at dberlin dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-10-22  7:15 UTC (permalink / raw)
  To: gcc-bugs



------- 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|0000-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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
  2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
                   ` (2 preceding siblings ...)
  2006-10-22  7:15 ` fxcoudert at gcc dot gnu dot org
@ 2006-10-26  8:28 ` patchapp at dberlin dot org
  2006-10-30 14:17 ` burnus at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: patchapp at dberlin dot org @ 2006-10-26  8:28 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
  2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
                   ` (3 preceding siblings ...)
  2006-10-26  8:28 ` patchapp at dberlin dot org
@ 2006-10-30 14:17 ` burnus at gcc dot gnu dot org
  2006-10-30 14:20 ` burnus at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-10-30 14:17 UTC (permalink / raw)
  To: gcc-bugs



------- 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=gcc&view=rev&rev=118184
Log:
fortran/
2006-10-26  Tobias Burnus  <burnus@net-b.de>

        PR fortran/29452
        * io.c (check_io_constraints): Fix keyword string comparison.

libgfortran/
2006-10-26  Tobias Burnus  <burnus@net-b.de>

        PR fortran/29452
        * runtime/string.c (compare0): Check whether string lengths match.

testsuite/
2006-10-26  Tobias Burnus  <burnus@net-b.de>

        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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
  2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
                   ` (4 preceding siblings ...)
  2006-10-30 14:17 ` burnus at gcc dot gnu dot org
@ 2006-10-30 14:20 ` burnus at gcc dot gnu dot org
  2006-10-30 14:21 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-10-30 14:20 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE
  2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
                   ` (5 preceding siblings ...)
  2006-10-30 14:20 ` burnus at gcc dot gnu dot org
@ 2006-10-30 14:21 ` burnus at gcc dot gnu dot org
  2006-10-30 14:24 ` [Bug fortran/29452] Keyword check for specifiers in WRITE and READ fxcoudert at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-10-30 14:21 UTC (permalink / raw)
  To: gcc-bugs



------- 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/29452] Keyword check for specifiers in WRITE and READ
  2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
                   ` (6 preceding siblings ...)
  2006-10-30 14:21 ` burnus at gcc dot gnu dot org
@ 2006-10-30 14:24 ` fxcoudert at gcc dot gnu dot org
  2006-10-30 18:23 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-10-30 14:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from fxcoudert at gcc dot gnu dot org  2006-10-30 14:24 -------
(In reply to comment #7)
> - 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

I'm planning to implement those soon. I'll keep that PR open and assigned to me
to be sure I remember :)


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|burnus at gcc dot gnu dot   |fxcoudert at gcc dot gnu dot
                   |org                         |org
            Summary|Keyword check for specifiers|Keyword check for specifiers
                   |in WRITE, READ and          |in WRITE and READ
                   |OPEN/CLOSE                  |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/29452] Keyword check for specifiers in WRITE and READ
  2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
                   ` (7 preceding siblings ...)
  2006-10-30 14:24 ` [Bug fortran/29452] Keyword check for specifiers in WRITE and READ fxcoudert at gcc dot gnu dot org
@ 2006-10-30 18:23 ` burnus at gcc dot gnu dot org
  2007-01-02 14:30 ` fxcoudert at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-10-30 18:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from burnus at gcc dot gnu dot org  2006-10-30 18:23 -------
Subject: Bug 29452

Author: burnus
Date: Mon Oct 30 18:22:47 2006
New Revision: 118191

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118191
Log:
fortran/
2006-10-30  Tobias Burnus  <burnus@net-b.de>

        PR fortran/29452
        * io.c (check_io_constraints): Fix keyword string comparison.

libgfortran/
2006-10-30  Tobias Burnus  <burnus@net-b.de>

        PR fortran/29452
        * runtime/string.c (compare0): Check whether string lengths match.

testsuite/
2006-10-30  Tobias Burnus  <burnus@net-b.de>

        PR fortran/29452
        * gfortran.dg/write_check.f90: Check run-time keyword checking.
        * gfortran.dg/write_check2.f90: Check compile-time keyword checking


Added:
    trunk/gcc/testsuite/gfortran.dg/write_check.f90
    trunk/gcc/testsuite/gfortran.dg/write_check2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/io.c
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/runtime/string.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/29452] Keyword check for specifiers in WRITE and READ
  2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
                   ` (8 preceding siblings ...)
  2006-10-30 18:23 ` burnus at gcc dot gnu dot org
@ 2007-01-02 14:30 ` fxcoudert at gcc dot gnu dot org
  2007-09-13 10:28 ` fxcoudert at gcc dot gnu dot org
  2007-10-18 13:39 ` fxcoudert at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-01-02 14:30 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|fxcoudert at gcc dot gnu dot|unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/29452] Keyword check for specifiers in WRITE and READ
  2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
                   ` (9 preceding siblings ...)
  2007-01-02 14:30 ` fxcoudert at gcc dot gnu dot org
@ 2007-09-13 10:28 ` fxcoudert at gcc dot gnu dot org
  2007-10-18 13:39 ` fxcoudert at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-09-13 10:28 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.0                       |---


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug fortran/29452] Keyword check for specifiers in WRITE and READ
  2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
                   ` (10 preceding siblings ...)
  2007-09-13 10:28 ` fxcoudert at gcc dot gnu dot org
@ 2007-10-18 13:39 ` fxcoudert at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-18 13:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from fxcoudert at gcc dot gnu dot org  2007-10-18 13:39 -------
I think it's best to close this one. I only wanted to keep it open because I
thought I'd add the rest of the F2003 specifiers quickly, which didn't happen.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29452


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-10-18 13:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-13 10:01 [Bug fortran/29452] New: Do compile-time specifier checks for WRITE and READ tobias dot burnus at physik dot fu-berlin dot de
2006-10-13 10:13 ` [Bug fortran/29452] Keyword check for specifiers in WRITE, READ and OPEN/CLOSE tobias dot burnus at physik dot fu-berlin dot de
2006-10-17 15:31 ` tobias dot burnus at physik dot fu-berlin dot de
2006-10-22  7:15 ` fxcoudert at gcc dot gnu dot org
2006-10-26  8:28 ` patchapp at dberlin dot org
2006-10-30 14:17 ` burnus at gcc dot gnu dot org
2006-10-30 14:20 ` burnus at gcc dot gnu dot org
2006-10-30 14:21 ` burnus at gcc dot gnu dot org
2006-10-30 14:24 ` [Bug fortran/29452] Keyword check for specifiers in WRITE and READ fxcoudert at gcc dot gnu dot org
2006-10-30 18:23 ` burnus at gcc dot gnu dot org
2007-01-02 14:30 ` fxcoudert at gcc dot gnu dot org
2007-09-13 10:28 ` fxcoudert at gcc dot gnu dot org
2007-10-18 13:39 ` fxcoudert at gcc dot gnu dot 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).