Article View: comp.sys.acorn.tech
Article #456Re: Bug found in v4 of Acorn C compiler
From: Philip Hazel
Date: Thu, 01 Oct 1992 09:20
Date: Thu, 01 Oct 1992 09:20
28 lines
1672 bytes
1672 bytes
In article <1992Oct1.033932.22482@cs.aukuni.ac.nz>, epoo1@cs.aukuni.ac.nz (Edouard Poor) writes: |> I've found a bug in v4 of the Norcroft C compiler, and this time I've |> managed to save the relevant code (unlike the first time I found a bug |> in the compiler a few months ago--I mentioned it but had no real proof, |> as I fixed the code before making a backup...) [stuff deleted] |> value = ( ( ( ( WORD ) fgetByte() ) << 8 ) | fgetByte() ); [...] |> The variable 'value' appeared to be getting the two bytes around the wrong |> way... This is not a bug. There is nothing in the ANSI standard which requires function calls in an expression of this type to be evaluated in a given order. The compiler is perfectly entitled to evaluate the second call to fgetByte before the first one. [Some operators *do* force an evaluation order, among them the logical operators || and &&, so that expressions like (a == NULL || *a == 0) make sense.] -- Internet: P.Hazel@ucs.cam.ac.uk University Computing Service, JANET: P.Hazel@uk.ac.cam.ucs Computer Laboratory, Pembroke St, Phone: +44 223 334714 Cambridge CB2 3QG, England.
Technical Details
Message-ID:
<1992Oct1.092044.14456@infodev.cam.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!pavo.csi.cam.ac.uk!camcus!ph10References:
<1992Oct1.033932.22482@cs.aukuni.ac.nz>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!pavo.csi.cam.ac.uk!camcus!ph10 From: ph10@cus.cam.ac.uk (Philip Hazel) Newsgroups: comp.sys.acorn.tech Subject: Re: Bug found in v4 of Acorn C compiler Message-ID: <1992Oct1.092044.14456@infodev.cam.ac.uk> Date: 1 Oct 92 09:20:44 GMT References: <1992Oct1.033932.22482@cs.aukuni.ac.nz> Sender: news@infodev.cam.ac.uk (USENET news) Organization: University of Cambridge Computing Service Lines: 28 Nntp-Posting-Host: bootes.cus.cam.ac.uk