[net.micro.pc] Xenix C Bug

steve@tellab3.UUCP (Steve Harpster) (06/14/85)

This was found by someone else here:

The C compiler under Xenix 286 (for the PC/AT) gets confused
about substrings in expressions.  It generates an assertion
error in emit.c and dies.  

The original code looked like:

	int a;
	char *x, tmp[30];

	a = (int) (&tmp[30] - x);

The fix was to use temporary variables:

	int a;
	char *x, *y, tmp[30];

	y = &tmp[30];
	a = (int) (y - x);

The reason I'm mentioning this is because the assertion
error message doesn't tell you where the problem is.
Emit.c is a routine used by the compiler which doesn't
help when you don't have source.  I hope this saves somebody
some time.

-- 


...ihnp4!tellab1!steve
Steve Harpster
Tellabs, Inc.