alloca, builtin!
Wonderly
gregg at ihlpb.ATT.COM
Thu Apr 27 23:55:54 AEST 1989
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 at ihlpb.att.com
AT&T Bell Laboratories UUCP: att!ihlpb!gregg
More information about the Comp.unix.wizards
mailing list