Re: Testing strategy for compiler

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Wed, 23 Jun 2010 18:18:39 +0000 (UTC)

          From comp.compilers

Related articles
[8 earlier articles]
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: Testing strategy for compiler barry.j.kelly@gmail.com (Barry Kelly) (2010-06-22)
Re: Testing strategy for compiler gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-06-23)
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Wed, 23 Jun 2010 18:18:39 +0000 (UTC)
Organization: Aioe.org NNTP Server
References: 10-06-037 10-06-044 10-06-050 10-06-054 10-06-061 10-06-064
Keywords: testing, design
Posted-Date: 25 Jun 2010 16:24:03 EDT

Andy Walker <news@cuboid.co.uk> wrote:
> On 21/06/10 22:16, George Neuner wrote:
>> In Pascal it's also illegal to write
>> FOR<var> :=<start> TO<finish> where start> finish
(snip)


> This is the sort of thing that would drive me *scranny* if I
> were ever forced to use these languages/compilers. You have some
> items to process in order, so you write


> FOR n := 1 TO nitems DO processitem (n) DONE


> What could be more natural? In sensible languages, that works whether
> "nitems" is 1, 100, 100000, ... or 0. If you want better control over
> possible values of "nitems", then you associate that control with the
> declaration of and assignments to "nitems", not with uses of it.


And then our moderator wrote:


> [You wouldn't like Fortran, in which the compiler is allowed to put the
> test at the bottom of a DO loop and always run the loop at least once. -John]


Well, they did change that in 1977.


As far as I know, the original rules were related to the 704 index
registers, kept in later machines. Also, the S/360 BXLE (branch on
index less than or equal) is very convenient for a test at the end DO
loop.


Even more, the Fortran rules through Fortran 66 didn't allow negative
or zero values for the start, end, or increment value, and, at least,
the IBM OS/360 compilers enforced that in the case of constants.


Then they might have overdone it in Fortran 77. I sort of like the
option to have UPTO and DOWNTO, specifying the loop direction.
Fortran 77 allows for either either positive or negative variable
increment, requiring more complicated logic at run time. Fortran 77
also pretty much requires the loop increment and limit to be evaluated
at loop entry and used for the duration of the loop.


Also, Fortran 77 allows for REAL (floating point) DO loops,
a feature removed in Fortran 90 and later.


-- glen



Post a followup to this message

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