[comp.unix.wizards] alloca, builtin!

gregg@ihlpb.ATT.COM (Wonderly) (04/27/89)

When I was at school, I buddy of mine was playing around looking for compiler
bugs in the C compiler on one of our departments research machines.  He 
wrote the following program.

main()
{
	int i, j, k;

	&i = &j;
}

He then did a cc(1) on the file.  Oddly enough, there was no comment from the
compiler.  He showed this to me and I said humm, that shouldn't work, so
we did a cc -S and examined the .s file.

The compiler generated a single instruction which loaded the stack/frame
pointer with the rvalue of the assignment.  Boy were we amazed!

BTW the compiler was PCC, and the flavor was Perkin Elmer/Concurrent's
XELOS (SYSVR2.1).  I never did look through the source to see what was done
but we tried other such expressions and discovered that it only works for the
very first local variable declared.

-- 
Gregg Wonderly                             DOMAIN: gregg@ihlpb.att.com
AT&T Bell Laboratories                     UUCP:   att!ihlpb!gregg