From cse.psu.edu!9fans-outgoing-owner Thu Nov  9 15:20:05 1995
Received: from plan9.ecf.toronto.edu ([128.100.8.9]) by stealth.ecf.toronto.edu with SMTP id <8249>; Thu, 9 Nov 1995 15:20:01 -0500
From:	9fans-outgoing-owner@cse.psu.edu
To:	steve@thrash.ecf.toronto.edu
Date:	Thu, 9 Nov 1995 15:16:18 -0500
Received: by colossus.cse.psu.edu id <78599>; Thu, 9 Nov 1995 14:59:59 -0500
Received: from plan9.att.com ([192.20.225.252]) by colossus.cse.psu.edu with SMTP id <78597>; Thu, 9 Nov 1995 14:59:42 -0500
Illegal-Object: Syntax error in From: address found on colossus.cse.psu.edu:
	From:	k.thompson<ken@plan9.att.com>
			  ^-missing end of mailbox
Message-Id: <95Nov9.152001edt.8249@stealth.ecf.toronto.edu>
Status: RO

From:	<ken@plan9.att.com>
To:	9fans@cse.psu.edu
Date:	Thu, 9 Nov 1995 08:31:13 -0500
Message-Id: <95Nov9.145942est.78597@colossus.cse.psu.edu>
Sender: owner-9fans@cse.psu.edu
Precedence: bulk
Reply-To: 9fans@cse.psu.edu

> From: haertel@ichips.intel.com
> The "8c" compiler sometimes loses track of side effects in expressions
> whose values aren't used.  For example, the following program should
> print "1" but in fact prints "0".
> ...

thanks to haertel for finding this. my fix follows.
ken

21a22,24
> 	l = n->left;
> 	r = n->right;
> 	o = n->op;
23,24c26,31
< 		if(nn != Z)
< 			gmove(n, nn);
---
> 		if(nn == Z) {
> 			if(o == OINDEX)
> 				nullwarn(l, r);
> 			return;
> 		}
> 		gmove(n, nn);
28,30d34
< 	l = n->left;
< 	r = n->right;
< 	o = n->op;


From cse.psu.edu!9fans-outgoing-owner Sun Mar 10 23:33:43 1996
Received: from colossus.cse.psu.edu ([130.203.1.2]) by cannon.ecf.toronto.edu with SMTP id <2487>; Sun, 10 Mar 1996 23:33:33 -0500
Received: by colossus.cse.psu.edu id <78380>; Sun, 10 Mar 1996 23:06:17 -0500
Received: from plan9.bell-labs.com ([192.20.225.253]) by colossus.cse.psu.edu with SMTP id <78413>; Sun, 10 Mar 1996 23:03:20 -0500
From:	"Ken Thompson" <ken@plan9.bell-labs.com>
To:	9fans@cse.psu.edu
Date:	Sun, 10 Mar 1996 19:22:08 -0500
Message-Id: <96Mar10.230320est.78413@colossus.cse.psu.edu>
Sender: owner-9fans@cse.psu.edu
Precedence: bulk
Reply-To: 9fans@cse.psu.edu
Status: RO

> Compiling gs, I ran cross a bug, distilled down to the
> following:
> 
> term% cat x.c
> void foo()
> {	
> 	char	a;
> 	int	b;
> 	char	d[1];
>         long e = a | (1 << b); 
> 
> 	while (1) d[b] = e;
> }
> 
> term% 8c x.c && 8l x.8
> foo: doasm: notfound (6)	SALL	BX,AX
> 
> foo: doasm: notfound (6)	SALL	BX,AX
> 
> foo: doasm: notfound (6)	SALL	BX,AX

the fix is to add the following lines.
in /sys/src/cmd/8c/peep.c

165a166,177
> 		case AROLB:
> 		case AROLL:
> 		case AROLW:
> 		case ARORB:
> 		case ARORL:
> 		case ARORW:
> 		case ASALB:
> 		case ASALL:
> 		case ASALW:
> 		case ASARB:
> 		case ASARL:
> 		case ASARW:


From cse.psu.edu!9fans-outgoing-owner Wed Mar 27 06:01:12 1996
Received: from colossus.cse.psu.edu ([130.203.1.2]) by cannon.ecf.toronto.edu with SMTP id <229>; Wed, 27 Mar 1996 06:01:09 -0500
Received: by colossus.cse.psu.edu id <78787>; Wed, 27 Mar 1996 05:51:37 -0500
Received: from plan9.cs.york.ac.uk ([144.32.33.120]) by colossus.cse.psu.edu with SMTP id <78785>; Wed, 27 Mar 1996 05:49:40 -0500
From:	forsyth@plan9.cs.york.ac.uk
To:	9fans@cse.psu.edu
Date:	Wed, 27 Mar 1996 01:56:43 -0500
Subject: re: a compiler bug?
Message-Id: <96Mar27.054940est.78785@colossus.cse.psu.edu>
Sender: owner-9fans@cse.psu.edu
Precedence: bulk
Reply-To: 9fans@cse.psu.edu
Status: RO

i'll correct my own correction:

vortex% diff $home/cd/cmd/8c cgen.c
1194c1194
< 		 * rewrite so lhs has no fn call
---
> 		 * rewrite so lhs has no side effects
1196c1196
< 		if(nn != Z && nn->complex >= FNX) {
---
> 		if(nn != Z && side(nn)) {


