Path: utzoo!utgpu!watmath!clyde!ima!cfisun!lakart!dg
From: dg@lakart.UUCP (David Goodenough)
Newsgroups: comp.lang.c
Subject: Re: Does your compiler get this program right?
Message-ID: <338@lakart.UUCP>
Date: 24 Nov 88 22:28:00 GMT
References: <2298@cbnews.ATT.COM>
Organization: Lakart Corporation, Newton, MA
Lines: 30

From article <2298@cbnews.ATT.COM>, by lvc@cbnews.ATT.COM (Lawrence V. Cipriani):
] A friend of mine found a bug in his C compiler.  He found
] the bug on a VAX; it also exists in some 3B compilers.  The
] compiler on this SVR3 3b2 does it right and is shown at the
] end.  The bug was that the increment to the float pointer
] was happening twice; see the /* miscompiled line */ below.
] I suspect other pcc derived compilers get it wrong too.
] 
Relevant parts of program:

] float list1[30], list2[10];
] 
] 	float *f, *g;
] 	
] 	f = list1;
] 	g = list2;
] 	for (i = 0; i < 10; ++i) {
] 		*f++ += *g++;		/* miscompiled line */
] 	}

We're using BSD4.3, w/ Greenhills C compiler. Output is as it should be,
so I would say that Greenhills doesn't have the bug. It has others .....
(I won't mention 4["Hello"] - we've hashed that out enough :-) :-) :-) )

Anyone else?
-- 
	dg@lakart.UUCP - David Goodenough		+---+
							| +-+-+
	....... !harvard!xait!lakart!dg			+-+-+ |
AKA:	dg%lakart.uucp@harvard.harvard.edu	  	  +---+