[cfe-dev] Address of register variable

Chris Lattner clattner at apple.com
Thu Nov 15 22:54:43 PST 2007


On Nov 14, 2007, at 6:44 AM, Sanghyeon Seo wrote:
> C99 6.5.3.2p1 forbids taking address of register variable. However,
>
> struct entry { int value; };
> void add_one(int *p) { (*p)++; }
>
> void test() {
>  register struct entry *p;
>  add_one(&p->value);
> }
>
> This code isn't doing that. p is register variable, but p->value
> isn't. But current clang gives:
>
> test.c:6:11: error: address of register variable requested
>
> Such code is present in GNU Make 3.81.

Yep, you're right. Fixed, thanks!

-Chris



More information about the cfe-dev mailing list