Code generation bug in Microsoft C 5.1
Christian Franke
franke at rwthinf.UUCP
Wed Aug 10 00:32:39 AEST 1988
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 at rwthinf.uucp ({...mcvax}!unido!rwthinf!franke)
More information about the Comp.lang.c
mailing list