Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.unix-wizards Subject: Re: Sun C compiler bug Message-ID: <1012@umcp-cs.UUCP> Date: Fri, 26-Jul-85 14:12:52 EDT Article-I.D.: umcp-cs.1012 Posted: Fri Jul 26 14:12:52 1985 Date-Received: Sun, 28-Jul-85 03:25:08 EDT References: <666@cvl.UUCP> Distribution: net Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 37 Speaking of Sun C compiler bugs, how about struct bug { struct { int field:4; } array[128]; }; f() { register struct bug *p; register int i; p->array[i].field; } which generates movl d7,d0 asll #1,d0 moveq #0,d0 ; sorry, guys, ya blew it movb a5@(0,d0:l),d0 lsrl #4,d0 andb #0xf,d0 The code is just fine except for the minor fact that it is using the same temp for both the subscript operation and the dereference. Makes all references to "register pointer to array of bitfield" access the 0th element, always. (The problem doesn't occur with arrays of anything else, nor with pointers to bitfields.) Without the compiler sources, of course, I can't provide a fix (hint hint :-) ). Note however that the problem goes away if one simply does not clear the destination of a move for a FLD reference, since the result will be masked anyway.... -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@maryland