Article ID: 811752
Article Last Modified on 5/26/2005
APPLIES TO
- Microsoft Windows CE .NET 4.1
SYMPTOMS
The Microsoft Windows CE 4.1 Platform Builder ARMV4I compiler version 12.20.9552 may produce incorrect machine code when it optimizes C code that uses a Byte (unsigned char) type-cast. The compiler may also produce incorrect machine code for the memset routine when optimization is enabled.
RESOLUTION
Software update information
A supported software update is now available from Microsoft as Windows CE .NET 4.1 Core OS QFE 811752. To resolve this problem immediately, click the following article number for information about obtaining Windows CE Platform Builder and core operating system software updates:
837392 How to locate core operating system fixes for Microsoft Windows CE Platform Builder products
Prerequisites
This software update is supported only if you have also installed all previously issued software updates for this product.
Restart requirement
After you install this software update, you must perform a clean build of the whole platform. To clean the platform, click Clean on the Build menu. To build the platform, click Build Platform on the Build menu. You do not have to restart your computer after you apply this software update.
Software update replacement information
This software update does not replace any other software updates.
File information
The English version of this software update package has the file attributes or later file attributes that are listed in the following table:
Date Time Version Size File name ------------------------------------------------------------------ 21-Jan-2003 23:14 4.1.3.121 1,571,432 030121_wce41-q811752.exe
The English version of this update has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
Date Time Version Size File name --------------------------------------------------------- 14-Jan-2003 19:25 12.20.9836.0 221,184 Armasm.exe 14-Jan-2003 19:24 12.20.9836.0 1,064,960 C1xx_arm.dll 14-Jan-2003 19:22 12.20.9836.0 569,344 C1_arm.dll 14-Jan-2003 19:25 12.20.9836.0 884,736 C2_arm.dll 14-Jan-2003 19:22 12.20.9836.0 61,440 Clarm.exe 14-Jan-2003 19:22 12.20.9836.0 50,176 Clthumb.exe
WORKAROUND
To work around this problem, you can disable compiler optimizations for user projects by using compiler command-line switches or by using the #pragma optimize directive.
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
MORE INFORMATION
The following code example demonstrates the problem with Byte type-case optimization. Compiled by using the Windows CE 4.1 Platform Builder ARMV4I compiler with optimizations enabled, the program will print "Checksum Failed". The CalculateCumulativeErrorWord function will always return 0xFFD2, and the Byte (unsigned char) cast of the WORD (unsigned short) type should retrieve the least significant byte, or 0xD2.
void CalculateCumulativeErrorWord(WORD * pwError) { int Temp = 10; *pwError = 0xFFFF; for (int i = 0; i < Temp; i++) { *pwError -= i; } } void TestFunction(void) { WORD Checksum = 0; BYTE TestValue = 0xD2; CalculateCumulativeErrorWord( &Checksum ); if ( (BYTE)Checksum != TestValue ) { _tprintf( TEXT("Checksum Failed!\r\n") ); } else { _tprintf( TEXT("Checksum Matched!\r\n") ); } }
Keywords: kbbug kbfix kbqfe KB811752