Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site ru-cs44.UUCP Path: utzoo!linus!security!genrad!mit-eddie!mit-vax!eagle!mhuxi!houxm!hogpc!houti!ariel!vax135!ukc!ru-cs44!adrian From: adrian@ru-cs44.UUCP Newsgroups: net.lang.mod2 Subject: Complicated boolean expressions Message-ID: <565@ru-cs44.UUCP> Date: Mon, 24-Oct-83 07:20:19 EDT Article-I.D.: ru-cs44.565 Posted: Mon Oct 24 07:20:19 1983 Date-Received: Wed, 26-Oct-83 04:35:51 EDT Organization: Reading Univ. UK. Lines: 40 Here's a simple prog. for you all to try. ========================================== MODULE test; FROM TTIO IMPORT WriteString, WriteLn; VAR x : INTEGER; a, b, c : INTEGER; BEGIN x := 1; a := 32; b := 32; c := 22; IF ((x = 1) AND ((a = b) OR (a = c))) OR ((x = 2) AND ((c = a) OR (c = b))) THEN WriteString('Succeeded',0) ELSE WriteString('Failed',0) END; WriteLn; END test. ========================================== On the New South Wales compiler running here, it prints 'Failed' which is incorrect. The problem seems to be in the code generated for the boolean expression s.t. if x=1 and a=b, the next test applied is ((c=a) OR (c=b)) which is in a different arm of the conditional. I'd be interested in anybody else's experiences with this and if you send me results by MAIL, I'll post a summary in a few weeks. Incidentally, the fix to our compiler is by no means obvious, and hasn't been done yet. Watch this space. -- Adrian Pell ({vax135,mcvax,edcaad}!ukc!ru-cs44!adrian) Computer Science Dept. University of Reading UK