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

ID: Q115534

1.00 WINDOWS kbtool kbfixlist kbbuglist

The information in this article applies to:

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:

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 kbbuglist kbfixlist
Version           : 1.00
Platform          : WINDOWS
Solution Type     : kbfix

Last Reviewed: September 22, 1997