分享

Fortran编程BUG的都市传说

 mtjs 2010-03-31

Fortran bug Urban Legend

In an earlier version of my Fortran language entry, I repeated the "well-known" Fortran bug that lost a spacecraft:

If a variable is not declared, it is implicitly given a type based on its first letter (I to N being integers, the rest floats). This led to the famous case of losing a spacecraft, when DO I = 1.100 was used instead of DO I = 1,100. The former statement assigns 1.100 to the variable DOI (spaces being ignored in names!), the latter is the start of a DO-loop.

However, on 25 February 1999, I received the following email from Brian Blank, which indicates that this well-known 'fact' is just an Urban Legend after all (which shows that I am just as guilty of repeating ULs as anyone):


Ordinarily I don't attempt to correct the web one fact at a time but a few days ago I received an email from a Belgian Scot who discovered one of my publicly accessible private pages via Alta Vista's infernal spider. It turns out that one of my computer factoids, the veracity of which I had confirmed in the Encyclopedia Britannica and the New York Public Library Science Desk Reference, was wrong. I learned some interesting things in verifying my correspondent's claim and feel quite content that I am no longer propagating a myth.

So either I am passing on a favor or seeking an outlet for revenge. The line of FORTRAN code

DO 10 I = 1.100
apparently did indeed occur. The compiler apparently did what it was supposed to do, ignoring white space and implicitly declaring and then assigning DO10I. Remarkably, the program was actually tested before use. The error was detected, thereby saving a rocket but ruining a future factoid. The demise of the rocket has been widely reported and has become part of programmer folklore.

Reference: Fortran Story - The Real Scoop, Forum on Risks to the Public in Computer and Related Systems, Vol. 9 #54, ACM Committee on Computers and Public Policy, 1989.

Regards

Brian Blank 
Department of Mathematics 
Washington University in St. Louis 
St. Louis, MO 63130 

email: brian@math. 
http://ascc.artsci./~bblank/


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多