Re: failure due to compiler?

ok@cs.rmit.edu.au (Richard A. O'Keefe)
20 Jul 1996 21:26:41 -0400

          From comp.compilers

Related articles
[15 earlier articles]
Re: failure due to compiler? dave_sc@csl.sri.com (1996-07-15)
Re: failure due to compiler? kanze@lts.sel.alcatel.de (1996-07-16)
Re: failure due to compiler? glew@ichips.intel.com (1996-07-16)
Re: failure due to compiler? WStreett@shell.monmouth.com (1996-07-16)
Re: failure due to compiler? grout@polestar.csrd.uiuc.edu (1996-07-18)
Re: failure due to compiler? gah@u.washington.edu (1996-07-19)
Re: failure due to compiler? ok@cs.rmit.edu.au (1996-07-20)
Re: failure due to compiler? LEEW@FS.MICROLOGIC.COM (Lee Webber) (1996-07-20)
Re: failure due to compiler? iwm@doc.ic.ac.uk (Ian Moor) (1996-07-20)
Re: failure due to compiler? WStreett@shell.monmouth.com (1996-07-20)
Re: failure due to compiler? jgllgher@maths.tcd.ie (Dara Gallagher) (1996-07-20)
Re: failure due to compiler? ok@cs.rmit.edu.au (1996-07-22)
Re: failure due to compiler? rfg@monkeys.com (1996-07-22)
[7 later articles]
| List of all articles for this month |

From: ok@cs.rmit.edu.au (Richard A. O'Keefe)
Newsgroups: comp.compilers
Date: 20 Jul 1996 21:26:41 -0400
Organization: Comp Sci, RMIT, Melbourne, Australia
References: 96-07-035 96-07-089
Keywords: errors

> resler@liberty.mas.vcu.edu (Dan Resler) writes:


>I am looking for pointers or references to descriptions where software
>has compiled without error and later failed due to compiler-introduced
>errors in the resultant program. In other words, the source was deemed
>to be error free but the compiler botched the code generation. Any
>help would be appreciated; thanks.


I had a problem with the Pascal compiler on Encore Multimaxes,
which I surmise to be due to constant propagation.
The code was something like this:


procedure Walk(var Self: Container;
procedure Process(var Item: Element);
-- body immaterial --


function CountNonEmptyElements(var Self: Container): Integer;
var Count: Integer;
procedure Process(var Item: Element);
begin if NonEmpty(Item) then Count := Count+1 end;
begin
Count := 0;
Walk(Self, Process);
CountNonZeroElements := Count;
end;


The compiler accepted this, and rightly so, because it was legal Pascal
code that other compilers had no trouble with.


The bug? CountNonEmptyElements always returned 0. The generated code
was as if the body of CountNonEmptyElements ended with
CountNonZeroElements := 0;


I was able to construct other examples which behaved as if
"constant propagation is blind to *indirect* procedure calls"
were true. (Note that CountNonEmptyElements does not call Process
itself; it *passes* that procedure to Walk, which calls it.)
--
Fifty years of programming language research, and we end up with C++ ???
Richard A. O'Keefe; http://www.cs.rmit.edu.au/~ok; RMIT Comp.Sci.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.