Microsoft KB Archive/115534

{|
 * width="100%"|

FIX: C1001: reg86.c:1.26, line 3154, Converting Short to Char

 * }

Q115534

1.00 WINDOWS kbtool kbfixlist kbbuglist -- The information in this article applies to: - The Microsoft C/C++ Compiler (CL.EXE), included with: - Microsoft Visual C++ for Windows, version 1.0 -- SYMPTOMS ======== Using global register and global code optimization when converting a short variable to a character, illustrated in the sample source code below (in the "MORE INFORMATION" section), causes the compiler to generate the following error: fatal error C1001: internal compiler error (compiler file '@(#)reg86.c:1.26', line 3154) RESOLUTION ========== There are three workarounds to this problem: - Use the fast compiler option, /f. -or- - Disable optimization using #pragma optimize("",off) before the function and #pragma optimize("",on) after the function containing the error. -or- - In the case of the source code below, use a temporary variable to store the converted value: BYTE temp=(BYTE)dry; BltRrc(pwnd, 0, 0, rrc.rxRight, (BYTE) (ryBottom - dry), 0, temp); STATUS ====== Microsoft has confirmed this to be a problem in the Microsoft products listed above. This problem was corrected in Visual C++ version 1.5. MORE INFORMATION ================ The following sample code can be used to demonstrate this problem: Sample Code --- /* Compile options needed: /Oge /AS /c */ typedef unsigned char BYTE; typedef unsigned short BOOL; typedef unsigned short WORD; typedef unsigned BITS; typedef BYTE RX; typedef BYTE RY; typedef struct _rrc { BYTE ryTop; BYTE rxRight; BYTE ryBottom; } RRC; typedef struct _wnd { WORD id; BITS style:14; BITS fCursorOn:1; BITS fEnabled:1; WORD rgwExtra[1]; } WND; typedef WND *PWND; void far pascal BltRrc(PWND, RX, RY, BYTE, BYTE, RX, RY); void ScrollListBox(PWND pwnd,short dry,BOOL fKillOld) { WORD iszTop; RRC rrc; WORD iszBottom; short iszNewTop; short iszNewBottom; WORD ryBottom; iszTop = pwnd->rgwExtra[1+3]; ryBottom = rrc.ryBottom; iszBottom = iszTop + ryBottom - 1; iszNewTop = iszTop + dry; iszNewBottom = iszBottom + dry; dry = iszNewTop - iszTop; BltRrc(pwnd, 0, 0, rrc.rxRight, (BYTE) (ryBottom - dry), 0, (BYTE) dry); } Additional reference words: 8.00 1.00 KBCategory: kbtool kbfixlist kbbuglist KBSubcategory: CLIss

Keywords : kb16bitonly kbCompiler

Issue type :

Technology : kbVCsearch kbAudDeveloper kbCVCComp