[net.unix-wizards] 4.2 cc/lint strangeness

edwards@felix.UUCP (Dave Edwards) (03/14/85)

I was wondering if someone could help me understand what is going
on with some problems with pcc that I am having.  I am running on
4.2BSD.

If I have a file which contains:

	unsigned a = (unsigned)5 >> 1;
	unsigned b = 5 >> 1;

then cc gives me the complaint:

	line 1: compiler error: expression causes compiler loop: try
		simplifying

and lint complains of an illegal initialization on that line.  The
construct on line 2 doesn't cause any problems.  Just declaring an
unsigned variable and doing the assignment as a statement also causes
no problems.

Also, I have a non-pcc based compiler that has no problem with this.

What gives?  Is this a known bug?

				Thanks,
				Dave Edwards
				FileNet Corp.
		{ucbvax,decvax,ihnp4,sdcrdcf}!trwrb!felix!edwards

darryl@ISM780.UUCP (03/17/85)

[]

Pcc has a bug regarding constant expressions containing casts.  This was
recently brought up in net.lang.c regarding an expression to get a mask with
the high order bit on using

unsigned int mask=~(~((unsigned)0)>>1);

The VAX System III pcc will choke on this, and there were other versions
of pcc indited as well.

	    --Darryl Richman, INTERACTIVE Systems Inc.
	    ...!cca!ima!ism780!darryl
	    The views expressed above are my opinions only.