Path: utzoo!utgpu!attcan!uunet!mcvax!unido!rwthinf!franke From: franke@rwthinf.UUCP (Christian Franke) Newsgroups: comp.lang.c Subject: Code generation bug in Microsoft C 5.1 Keywords: Microsoft, Compiler, bug Message-ID: <688@rwthinf.UUCP> Date: 9 Aug 88 14:32:39 GMT Organization: RBI - RWTH Aachen Lines: 45 Code generation bug in Microsoft C 5.1 (MS-DOS, OS/2) ====================================== If an unsigned char variable is {pre|post}incremented inside an array subscript, the compiler generates code to increment a *word*. The error does not occur if the variable is signed. Example char c; unsigned char uc; char a[10]; error() { char i; i = uc++; /* OK */ i = a[c++]; /* OK */ i = a[uc++]; /* Error */ } Code generated ;****** i = a[uc++]; mov bl,BYTE PTR _uc inc WORD PTR _uc *WOW* sub bh,bh mov al,BYTE PTR _a[bx] mov BYTE PTR [bp-2],al This error does not occur with MSC version 4.0. Christian Franke Aachen University of Technology Lehrstuhl fuer Informatik I Ahornstrasse 55 D-5100 Aachen Federal Republic of Germany Tel.: 0241 / 80-3586 UUCP: franke@rwthinf.uucp ({...mcvax}!unido!rwthinf!franke)