Microsoft KB Archive/33136

Incorrect Code Generated for Return and Pointer PSS ID Number: Q33136 Article last modified on 10-12-1988 PSS database name: S_QuickC

1.00 1.01

MS-DOS

Summary: The following program has two routines that should both return an unsigned character located at FFFF:000E. If the absolute address is assigned to a pointer and then the value at the pointer is returned, everything works correctly. However, the code generated for the following statement in the function t2 incorrectly treats the hex constant as the value to be returned and the program prints fail:

return (char far )0xffff000eL;

Microsoft has confirmed this to be a problem with Versions 1.00 and 1.01 of the QuickC compiler. We are researching this problem and will post new information as it becomes available.

More information: The following code reproduces the problem:

void main; unsigned char t1(void); unsigned char t2(void);

void main { int res1,res2; if (t1 != t2) printf(“failed”); else printf (“passed”);

}

unsigned char t1 { unsigned char far pm = (unsigned char far )0xffff000eL; return *pm; }

unsigned char t2 { return (char far )0xffff000eL; }

Copyright Microsoft Corporation 1988.