C9112006: /Zg May Cause C2041 Error with Inline Assembly

ID Number: Q79209

6.00 6.00a 6.00ax | 6.00 6.00a

MS-DOS | OS/2

buglist6.00 buglist6.00a buglist6.00ax

Summary:

PROBLEM ID: C9112006

SYMPTOMS

When using the /Zg flag with the Microsoft C Compiler version 6.0,

6.0a, or 6.0ax, using an immediate value that is preceded by a zero

and that contains a digit larger than seven (for example, 018) in

an inline assembly statement causes the following error:

C2041: Illegal digit 'x' for base 8

Where 'x' is some digit larger than seven.

CAUSE

The compiler mistakes the value for an octal value when the /Zg

flag is used.

RESOLUTION

To work around the problem, remove the preceding zero(es) from the

value. For example, changing 08H to 8H or 0x08 in the sample code

solves the problem.

STATUS

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

6.0ax. We are researching this problem and will post new

information here as it becomes available.

More Information:

In the sample code below, the compiler mistakes the 08H for an octal

value when the /Zg flag is used.

Sample Code

-----------

/* Compile options needed: /c /Zg

*/

void test(void)

{

_asm mov ax, 08H

/* Replacing the above line with one of the following works around the

* problem:

* _asm mov ax, 8H

* _asm mov ax, 0x08

*/

}

Additional reference words: 6.00 6.00a 6.00ax