🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.acorn.tech
Article #459

Re: Bug found in v4 of Acorn C compiler

#459
From: Harry Meekings
Date: Thu, 01 Oct 1992 11:07
37 lines
1895 bytes
In article <1992Oct1.033932.22482@cs.aukuni.ac.nz> epoo1@cs.aukuni.ac.nz (Edouard Poor) writes:

>
>void startDecode( void )
>    {
>    /* Initialize the bit input routines.  Since this is dual-use code
>       we can only read in 8 bits of a possible 16 */
>
>    value = ( ( ( ( WORD ) fgetByte() ) << 8 ) | fgetByte() );
>
> ....
>
>One genuine bug.
>

Indeed so, but in the program not in the compiler.  The order of evaluation
of subexpressions is unspecified (except where there's a sequence point as with
operators such as &&).  This, by the way, is explicitly stated in K&R 1, not
an invention of ANSI.  It so happens that the Acorn compiler in this case
chooses to evaluate the right-hand call of fgetByte before the left-hand
one, for reasons which have nothing to do with the optimiser.  You have been
given one of the two values you ambiguously asked for, and can't very well
complain.

With regard to dhrystone figures, you seem to live in a different world from
the rest of us.  The ground rules for dhrystone are:
 *  - Separate compilation
 *  - No procedure merging
 *  - Otherwise, compiler optimizations are allowed but should be indicated
 *  - Default results are those without register declarations
No 'use default options' there, and indeed looking at the set of reported
dhrystone times, I don't see any which don't use at least -O; many use exotic
-O sub-options

Harry Meekings

I speak for myself alone, etc etc.
Technical Details
Message-ID: <7581@armltd.uucp>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!acorn!armltd!hmeekings
References: <1992Oct1.033932.22482@cs.aukuni.ac.nz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!acorn!armltd!hmeekings
From: hmeekings@armltd.co.uk (Harry Meekings)
Newsgroups: comp.sys.acorn.tech
Subject: Re: Bug found in v4 of Acorn C compiler
Message-ID: <7581@armltd.uucp>
Date: 1 Oct 92 11:07:13 GMT
References: <1992Oct1.033932.22482@cs.aukuni.ac.nz>
Sender: hmeeking@armltd.uucp
Distribution: comp
Organization: A.R.M. Ltd, Swaffham Bulbeck, Cambs, UK
Lines: 37