[comp.sys.amiga] BIG BUG in Manx3.6a

tdwest@orchid.waterloo.edu (Terry D. West) (02/29/88)

Well, I guess I have the dubious honour of reporting the first
major bug in 3.6a 12-18-87 Manx C :-(

Jim, are you listening? Good.

Beware of pointer comparisons and assignments under the +L option.
It seems that the _indirect_ pointer comparison result assigned
_indirectly_ really breaks the compiler.  It gurus during compilation
due to an odd address reference on a move.w instruction.

Here's a short file which bares all:

--------- cut here, compile, and guru during compilation -----------

/* bomber.c
 *
 * This program gurus the MANX 3.6 compiler 
 * when the +L option is used.
 *
 * Copyright 1988 Terry D. West & Jeff A. Voskamp :-)
 * Who'd reserve rights to this?
 *
 */

struct STYPE{ 	
	struct STYPE *next;
	long i;
} *s1,*s2;

main()
{
	long ll;
	struct STYPE *sp1,*sp2;

	/* This one gurus */

	s1->i = (s1->next != s2->next); 

	/* but none of these do! */

	s1->i = ( (long) (s1->next) != (long) (s2->next));

	ll = (s1->next != s2->next); 

	sp1 = s1->next;
	sp2 = s2->next;

	s1->i = (sp1 != sp2);
	s1->i = (sp1 != s2->next); 
	s1->i = (s1->next != sp2);
}

--
Terry D. West
watmath!orchid!tdwest
tdwest@orchid.waterloo.edu

manx@well.UUCP (Jim Goodnow II) (03/02/88)

In article <12325@orchid.waterloo.edu> tdwest@orchid.waterloo.edu (Terry D. West) writes:
>Well, I guess I have the dubious honour of reporting the first
>major bug in 3.6a 12-18-87 Manx C :-(
.......
>
>	s1->i = (s1->next != s2->next); 
>

Before anyone gets too upset about the robustness of 3.6, they should
realize that this bug also exists in 3.4b and 3.4a. However, anyone still
using 3.2 will have nothing to worry about :-). The fact that it has been
a bug for over a year may attest to the fact that it is not exactly a
common expression.

At any rate, thanks for the bug report. The problem has been fixed and
added to our test suite. Keep those cards and letters coming...

Jim Goodnow II
Manx Software Systems

Usenet: well!manx
BIX:    jgoodnow