Re: Testing strategy for compiler

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Sat, 19 Jun 2010 18:41:42 +0000 (UTC)

          From comp.compilers

Related articles
[2 earlier articles]
Re: Testing strategy for compiler zaimoni@zaimoni.com (Kenneth 'Bessarion' Boyd) (2010-06-17)
Re: Testing strategy for compiler ott@mirix.org (Matthias-Christian Ott) (2010-06-18)
Re: Testing strategy for compiler gene.ressler@gmail.com (Gene) (2010-06-18)
Re: Testing strategy for compiler gneuner2@comcast.net (George Neuner) (2010-06-18)
Re: Testing strategy for compiler gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-06-18)
Re: Testing strategy for compiler ott@mirix.org (Matthias-Christian Ott) (2010-06-19)
Re: Testing strategy for compiler gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-06-19)
Re: Testing strategy for compiler jm@bourguet.org (Jean-Marc Bourguet) (2010-06-21)
Re: Testing strategy for compiler dot@dotat.at (Tony Finch) (2010-06-21)
Re: Testing strategy for compiler gneuner2@comcast.net (George Neuner) (2010-06-21)
Re: Testing strategy for compiler news@cuboid.co.uk (Andy Walker) (2010-06-22)
Re: Pascal design, was Testing strategy for compiler marcov@turtle.stack.nl (Marco van de Voort) (2010-06-22)
Re: Pascal loops, was Testing strategy for compiler gneuner2@comcast.net (George Neuner) (2010-06-22)
[5 later articles]
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Sat, 19 Jun 2010 18:41:42 +0000 (UTC)
Organization: Aioe.org NNTP Server
References: 10-06-037 10-06-044 10-06-050
Keywords: testing
Posted-Date: 19 Jun 2010 21:02:14 EDT

George Neuner <gneuner2@comcast.net> wrote:
(snip)


> But John is correct that this won't test semantics ...
(snip)


> I once used a Pascal compiler that happily accepted garbage like


> for n := 1 to 10 by -1
> do ...


> and generated an unreachable loop body. I forget why the optimizer
> didn't just remove the loop ... probably the implementation used a
> hidden loop counter to guarantee FOR iteration. What the compiler
> should have done was reject the invalid step count.


Is that illegal in PASCAL? I haven't thought about PASCAL recently,
but I don't believe that such a loop is illegal in the other languages
with a similar loop construct.


It might be that unreachable statements without a statement number
are illegal in Fortran:


            GOTO 123
            PRINT *,'can''t get here!'


but otherwise it is usually the optimizer that complains.


I do remember (from a long time ago, well, early in my Fortran days)
that the IBM S/360 Fortran G compiler gives a level 0 message
for unreachable statements, where Fortran H gives a level 4.


In the usual terminology, level 4 is warning, level 8 is error,
level 12 is fatal error, such that level 0 isn't even warning!


The Fortran H optimizer needs to keep track of program flow for
optimization reasons, but Fortran G doesn't.


-- glen



Post a followup to this message

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