> although FORTRAN is very special,
because it allows spaces even in the middle of identifiers

Exactly. Were "DO I=1,10" a valid PL/I DO statement, typing a period 
instead of a comma might make it the wrong DO statement, but could not make it 
an assignment statement.

>  IF 9 < ZZ < 20 THEN DO;

Yes, there are languages that allow what was intended.


________________________________________
From: IBM Mainframe Discussion List <[email protected]> on behalf of 
Bernd Oppolzer <[email protected]>
Sent: Tuesday, March 29, 2022 4:57 PM
To: [email protected]
Subject: Re: PL/I question

As it seems from other posts, the story is not completely true;
there was indeed such an error somewhere sometime with NASA,
but the error that destroyed the Mariner spacecraft was different (a
missing hyphen on
a hand-written variable specification, which had not been translated
correctly to computer code).

I believe that there are similar pitfalls in other languages, too,
although FORTRAN is very special,
because it allows spaces even in the middle of identifiers (and
numbers), such as

    DO  3  I    =   1 . 10

which in every other programming language would disqualify as an
assignment statement
because of the spaces around the DO symbol.

My favorite PL/1 example from a real world program is this:

    IF 9 < ZZ < 20 THEN DO; ...

someone with a math background obviously coded this :-)
the expectation was, that the statement be executed if ZZ is in the
range 10 to 19.

Unfortunately, this is translated by PL/1 as follows:

    IF (9 < ZZ) < 20 THEN DO;

9 < ZZ is a result of type BIT(1) and yields '0'B or '1'B, depending on ZZ;
this result is converted to decimal, so that it can be compared to the
decimal constant 20
and the result therefore is ALWAYS FALSE.

This is clearly not what the coder had intended.

We detected this luckily, using a site-written PL/1 diagnosing tool,
which complained because of the
implied type conversion (BIT(1) to decimal). About 2 percent of the
total PL/1 code base
had similar logic errors, which were undetected before we scanned all
the source codes with our
new tool in 2007. After that, we changed the deployment processes, so
that the new tool
runs with every software deployment.

Kind regards

Bernd


Am 29.03.2022 um 17:03 schrieb David Spiegel:
> Hi gil,
> I remember reading the article approximately 40 years ago.
> It was in Datamation, which was an IT magazine.
> You've never heard of Datamation before? ... How many years have you
> been in this business?
>
> The story was related to an unmanned spaceship (i.e. Venus Probe)
> whose trajectory was calculated by a FORTRAN program
> with the following statements:
> DO 3  I=1.3
> .
> .
> 3
>
> Since there was a period between "1" and "3" (instead of a comma), the
> loop ran precisely once
> and assigned 1.3 to DO3I (FORTRAN removes blanks before compile) a
> variable which is automatically declared REAL, because its first letter
> is outside the INTEGER Range I-N.
>
> Here is another reference (not Datamation) (which does not mention the
> financial loss)
> Please see:
> IEEE Xplore Full-Text PDF:
> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fieeexplore.ieee.org%2Fstamp%2Fstamp.jsp%3Farnumber%3D4392951&amp;data=04%7C01%7Csmetz3%40gmu.edu%7C4616b9f6e98748b02adf08da11c6c267%7C9e857255df574c47a0c00546460380cb%7C0%7C0%7C637841842622249901%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=2%2BCvgzY6DMp%2BZO1%2F4m%2F%2BKYzJ0CHWTlZZs4FCIRYUW2k%3D&amp;reserved=0>
> Page 58
>
> Regards,
> David
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to