Re: compiler bugs

Louis Krupp <lkrupp@indra.com>
Tue, 28 Apr 2009 11:33:36 -0600

          From comp.compilers

Related articles
Re: Compiler bugs Peter-Lawrence.Montgomery@cwi.nl (2002-01-05)
Re: Compiler bugs christian.bau@cbau.freeserve.co.uk (Christian Bau) (2002-01-05)
Re: Compiler bugs chase@world.std.com (David Chase) (2002-01-14)
compiler bugs SidTouati@inria.fr (Sid Touati) (2009-04-27)
Re: compiler bugs DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-04-28)
Re: compiler bugs r3jjs@yahoo.com (Jeremy J Starcher) (2009-04-28)
Re: compiler bugs lkrupp@indra.com (Louis Krupp) (2009-04-28)
Re: compiler bugs jonathan@nitrogen.astro.indiana.edu (Jonathan Thornburg) (2009-04-28)
Re: compiler bugs jgd@cix.compulink.co.uk (2009-04-28)
Re: compiler bugs georgeps@xmission.com (George Peter Staplin) (2009-04-28)
Re: compiler bugs marcov@stack.nl (Marco van de Voort) (2009-04-29)
Re: compiler bugs torbenm@pc-003.diku.dk (2009-04-29)
Re: compiler bugs dot@dotat.at (Tony Finch) (2009-04-29)
[16 later articles]
| List of all articles for this month |

From: Louis Krupp <lkrupp@indra.com>
Newsgroups: comp.compilers
Date: Tue, 28 Apr 2009 11:33:36 -0600
Organization: indra.com
References: 09-04-072
Keywords: errors
Posted-Date: 28 Apr 2009 14:51:36 EDT

Sid Touati wrote:
> How can a simple programmer detect a bug in a compiler ? is there some
> well known verification techniques ?
>
> I am afraid that many bugs are hidden inside compiler activated with
> sophisticated optimisation options, and few people can detect them: when
> a user program does not work, we usually think that the problem comes
> from the program itself, not from the compiler nor from the processor.
>
> On the other hand, when a compilation flag is on and the program
> crashes, we usually think that the bug comes from the compiler not from
> the program...


Identifying compiler bugs is usually a lot of work. Start with a
program that fails somewhere in its thousands of lines of code, and
spend the next few hours removing pieces until you have a minimal
program that reproduces the problem (or at least a problem -- there
could be more than one). In the early 90's, I spent a few years as a
contractor porting C++ code from one buggy compiler to another, so I
saw a lot of these. In one case, a C compiler generated bad code when
the program used a pointer to a function that took a float argument.
A later version of the compiler would have worked, but the customer
was too cheap to upgrade. I think I spent about 12 straight hours on
that one.


You'll need to be able to read compiler-generated assembly code.
Ironically, you won't need to be an expert in the compiled language; I
used the Annotated Reference Manual a lot, but by the time I got a C++
file down to the 20 lines or so needed to demonstrate the problem, it
was pretty obvious that there was a bug.


It's all worth it when you can send a description of the problem and
some sample code to the vendor, and it gets fixed.


(This was all a *lot* more fun years ago when I worked on Burroughs
Large Systems and they shipped the source code and I could fix some of
these in the field and report the problem to Mission Viejo along with
my suggested patch.)


Louis


Post a followup to this message

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