Article View: comp.sys.mac
Article #23053misc MSF77 surprises
From: mcnabb
Date: Fri, 18 Dec 1987 21:17
Date: Fri, 18 Dec 1987 21:17
59 lines
2677 bytes
2677 bytes
Here's an interesting MS FORTRAN 77 compiler V2.2 behavior that confused
(might one say abused?) an amazing number of my students this semester:
> 00001 program STRTST
> 00002 character*14 STR1, STR2
> 00003
> 00004 STR1 = 'abcdefghijklmnopqr'
> 00005 C Now for erroneous use of STR1:
> 00006 STR2 = STR1 (2,5)
> 00007 C Some filler lines:
> 00008 print *, 'STR1 = "', STR1, '"'
> 00009 print *, 'STR2 = "', STR2, '"'
> 00010 C Now for proper use of STR1:
> 00011 STR2 = STR1 (2:5)
>
> ***** error in line 00011 [TR1 (2]: too many left parantheses
>
> 00012
> 00013 stop
> 00014 end
>
> ***** 1 error
Note that improper use (as a 2-D array) of the STR1 string variable is
not flagged, and the compiler subsequently forgets that STR1 is a string.
This is especially hard on beginning FORTRAN students since the point of
detection may be many lines beyond of the point of the error.
(BTW, would some Microsoft person on the net be so kind as to tell me
what "parantheses" are? I think even one of these would be too many. :-)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Another one "good for a grin" is the beginner's DO-loop running from 1
to "10000" (yes, many beginners make this mistake):
> do 99 I = 1, 10,000
> ...
This one actually crashes the compiler and often takes the system out too.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Speaking of crashing the system ...
One of my TAs is working on a "lint" program for FORTRAN to give students
a means of finding mis-matched actual and formal argument lists. Since
most of these mismatches cause MSF runtime crashes (i.e. system dies too),
and some even cause compile-time crashes (ditto), such a program would be
invaluable to the students. If anyone else is interested (or has already
written such a beast!) please contact me by email.
David McNabb
Department of Computer Science
University of Illinois at Urbana-Champaign
USENET: ...!{cmcl2,seismo,ihnp4}!uiucdcs!mcnabb
ARPA: mcnabb@a.cs.uiuc.edu
Technical Details
Message-ID:
<164500075@uiucdcsb>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!iuvax!pur-ee!uiucdcs!uiucdcsb!mcnabbShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!iuvax!pur-ee!uiucdcs!uiucdcsb!mcnabb From: mcnabb@uiucdcsb.cs.uiuc.edu Newsgroups: comp.sys.mac Subject: misc MSF77 surprises Message-ID: <164500075@uiucdcsb> Date: 18 Dec 87 21:17:00 GMT Lines: 59 Nf-ID: #N:uiucdcsb:164500075:000:2263 Nf-From: uiucdcsb.cs.uiuc.edu!mcnabb Dec 18 15:17:00 1987