comp.lang.ada
 help / color / mirror / Atom feed
From: dog.ee.lbl.gov!overload.lbl.gov!agate!howland.reston.ans.net!darwin.sura. net!news-feed-1.peachnet.edu!umn.edu!sctc.com!stachour@ucbvax.Berkeley.EDU  (Pa ul Stachour)
Subject: Re: XX(PL/I)  to Ada translator/lessons learned
Date: 26 May 93 07:02:18 GMT	[thread overview]
Message-ID: <1993May26.070218.5567@sctc.com> (raw)

tsorense@perky.dasd.honeywell.com (Todd A Sorensen) writes:

>A warning to those who are contemplating such a job as translation of code
>from one language to another:

>We translated Intel PLM (c) to Ada,  while we got about a 90% yield
>syntactically,  the functional yield was below 50%.  (it was fairly easy to
>get to compile, but it didn't work)
------------------------------------------------------------
Several years ago I was given a job to do.  I didn't know anything
about the subject.  I did a short literature search. It turned up
a paper by Morrie Glasser, and a reference to the PL/I Code on
Multics that did the job.  I talked to some people on the phone,
and got a copy of the copy.  I was told that the code had ran for
more than 10 years, and never had a fault, nor any reported failure.

Well, I was working in C, so I translated the code to C.
Like in any translation, you have problems when the language
you are translating into doesn't support some things that the
language you are trasnlating from does.  Anyhow, I did a realitvely
straigtforward translation.  The code looked (and was) ugly; caused
by the fact that the PL/I used internal procedures; C doesn't have
that, and the shared variables into the internal procedures
made it quie wierd when I got done.

Anyhow, it compiled without error.  Been ruuning two yers now.
Still looks ugly; not maintainable, but it doesn't need to be.
It works. Gets the right answers. Never faults.

Well, not quite true.  As an experiment, I translated the same
PL/I code into Ada.  Yes, it was still a little wierd.  Not as
bad as the C, but still weird.  So I compiled the code (no error
messages), and ran a few test-cases.  Bamb! Took an exception
(arressing outside the bounds of an array) on the first test.

Analysis time.  Yep, the code is "coincidentally correct".
The element of the array that's out-of-bounds is combined
with other data in such a way that it never affects the 
results of the computation.

But, it is a lurking boundary condition just waiting to happen.
Some day, with some compiler, it'll lay out the data-structures
to put that "wrong element" in the next page of memory, which
my program doesn't own.  And then it won't be a benign error;
it'll be a real failure.

Moral of the Story:
  You may find more than you want when you take a "working"
program and move it to another environment.

Cheers, ..Paul

-- 
Paul Stachour              SCC, 2675 Long Lake Road
stachour@sctc.com          Roseville, MN  55113
                             [1]-(612) 628-2782

             reply	other threads:[~1993-05-26  7:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-05-26  7:02 Pa ul Stachour [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-05-26 15:29 XX(PL/I) to Ada translator/lessons learned Michael Feldman
1993-05-26 18:08 dog.ee.lbl.gov!overload.lbl.gov!agate!howland.reston.ans.net!ux1.cso.uiuc.edu!moe.ksu.ksu.edu!kuhub.cc.ukans.edu!hawk!billk
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox