C compiler bug (I think).

Guy Harris guy at rlgvax.UUCP
Sat Aug 25 10:40:26 AEST 1984


> Apparenly, cc compiler does not tolerate shifting unsigned values in
> initialization of global variables. Trying to compile the subroutine on
> the left produces the diagnostics:
> 
>     line 1: compiler error: expression causes compiler loop: try simplifying
> 
>  | int one = (((unsigned) 2) >> 1);    |    int ONE()                          |

I believe you are correct, and it is a compiler bug.  I remember running
into similar bugs in our 68K C compiler; casts are not always dealt with
correctly in expressions evaluated at compile time.  Unfortunately, I
don't have a fix at hand.  (Some routine which, in effect, evaluates
casts at compile time is either not being called or isn't recognizing the
cast as something it should clean up.)

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy



More information about the Comp.lang.c mailing list