PRB: /qc Option Can't Be Combined w/ /Ol & Register Variables

ID Number: Q67039

6.00 6.00a 6.00ax | 6.00 6.00a

MS-DOS | OS/2

buglist6.00 buglist6.00a buglist6.00ax fixlist7.00

Summary:

SYMPTOMS

When using either QuickC or the quick compile option (/qc) with

Microsoft C Compiler version 6.0, 6.0a, or 6.0ax, loop

optimization (/Ol) cannot be specified for any functions that

contain variables declared with the register storage-class that are

referenced in an inline assembly (_asm) block.

This combination will result in the following compiler error for

any register variables referenced in the inline assembly code:

error C2418: variable not in a register.

CAUSE

This problem occurs because /Ol results in register variables not

being allocated in registers, a problem that also occurs with the C

compiler without /qc. For more information, query on the following

words in the Microsoft Knowledge Base:

C4024 and register and inline and stack

Because the variables are not in registers, the compiler cannot

handle register instructions that reference them in the inline

assembly; therefore, the C2148 error is generated. When using the C

compiler without /qc, /Ol is prevented from causing this problem.

RESOLUTION

To work around this problem, eliminate one of the following three

contributing factors:

- Turn off loop optimization.

-or-

- Do not use register variables that are referenced in an _asm

block.

-or-

- Compile without /qc.

STATUS

Microsoft has confirmed this to be a problem in C versions 6.0 and

6.0a and QuickC versions 2.5 and 2.51 (buglist2.50 and

buglist2.51). This problem was corrected in C/C++ version 7.0.

Additional reference words: 6.00 6.00a 6.00ax