From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Sat, 16 Feb 2013 21:38:09 -0500 To: 9fans@9fans.net Message-ID: <33b72a69832f3b5442b659b76e41a8a7@brasstown.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] c compiler bug Topicbox-Message-UUID: 18c10d92-ead8-11e9-9d60-3106f5b1d025 i don't think this should link, since wrongaddr calls fn with an Outer* not an Inner*. #include #include typedef struct Inner Inner; typedef struct Outer Outer; struct Inner { int x; }; struct Outer { char buf[0x1000]; Inner; }; void wrongaddr(Outer *o) { static void fn(Outer*); fn(o); } void main(void) { Outer *o; o = malloc(sizeof *o); memset(o, 0, sizeof *o); print("addr o %#p\n", o); print("addr o.x %#p\n", &o->x); wrongaddr(o); } static void fn(Inner *i) { print("fn addr i.x %#p\n", &i->x); } ; 6.cbug addr o 0x4018f0 addr o.x 0x4028f0 fn addr i.x 0x4018f0