K&R C (section 4.7) states that passing the address of a "register" variable is not allowed. Thus the following program should fail but doesn't:
======== begin ========
extern int foo(int *);
int mumble(int val)
register int r = val;
======== end ========
gcc and Sun's Studio 12 flag the address-of-register error:
$ /opt/SUNWspro/bin/cc -c test.c
"test.c", line 8: cannot take address of register: r
cc: acomp failed for test.c
$ gcc -c test.c
test.c: In function ‘foo’:
test.c:8:2: error: address of register variable ‘r’ requested
$ /build/sdcc/sdcc-20120817-8070/bin/sdcc -c test.c
$ echo $?
I realise that the "register" storage class is a hint, and the compiler is entitled to elect not to keep it in a register, but the K&R book says:
"And it is not possible to take the address of a register variable (a topic covered in Chapter 5), regardless of
whether the variable is actually placed in a register."
Thus the C front end should reject the above test program.