Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site hcrvx1.UUCP Path: utzoo!hcrvax!hcrvx1!hugh From: hugh@hcrvx1.UUCP (Hugh Redelmeier) Newsgroups: net.bugs,net.micro,net.micro.pc Subject: 8086 family CPU bug Message-ID: <1190@hcrvx1.UUCP> Date: Fri, 5-Jul-85 08:34:56 EDT Article-I.D.: hcrvx1.1190 Posted: Fri Jul 5 08:34:56 1985 Date-Received: Sat, 6-Jul-85 04:11:14 EDT Organization: Human Computing Resources, Toronto Lines: 31 Summary: shift by zero does not set flags All 8086 manuals I have read say that shift instructions set the flags to reflect the value of the result. All the chips that I have tested (8086, 8088, 80186) do not set the flags if the shift count is zero. I discovered this when the following C code gave the wrong answer (under XENIX 2.1 -- not their fault though) (this code is from memory, so it may be slightly inaccurate): main() { register int i, j; i = 0; j = 1; j += 1; /* clear Z flag */ if (i << i) /* shift of 0 by 0 should set Z flag, but doesn't */ printf("WRONG!\n"); } [Even if the predicate is written more cleanly as (i<