FIX: Program Hangs when Startup Code Refers to __qczrinit

ID: Q92408

5.30 | 5.30 MS-DOS | WINDOWS kbtool kbcode kbbuglist kbfixlist

The information in this article applies to:

SYMPTOMS

When an application is compiled with Microsoft C version 6.0, it runs without any problems. However, when the application is rebuilt using Microsoft C/C++ version 7.0, the program hangs in the CTR0.ASM module while executing the following code:

   MOV  cx, __qczrinit        ;* Get initializer address
   JCXZ @f                    ;* Is it zero?
   CALL cx                    ;* No -- call indirect

CAUSE

There is a problem in the Microsoft Linker (LINK) version 5.3 that does not initialize data in the DGROUP segment to 0.

RESOLUTION

There are two methods resolve this problem:

STATUS

Microsoft has confirmed this to be a problem in LINK version 5.3. This problem was corrected in LINK version 5.31.009.

MORE INFORMATION

The C 6.0 startup code explicitly initializes _qczrinit to 0 when the variable is declared. The C/C++ 7.0 startup code does not initialize the symbol. Instead the code relies on the linker to perform the initialization automatically. There is a problem in the Microsoft Linker (LINK) version 5.3 that does not initialize data in the DGROUP segment to 0.

Because the _qczrinit value is not initialized, if the random data in the _qczrinit variable is not zero, the startup code calls the address to which the _qczrinit variable points. Calling a random address in this manner causes the system to hang.

Additional reference words: 5.30 KBCategory: kbtool kbcode kbbuglist kbfixlist KBSubcategory: LinkIss

Keywords          : kb16bitonly 
Solution Type     : kbfix

Last Reviewed: September 17, 1997