QCW9111002: C4410: Illegal Size for Operand with LEA Instruct.

ID Number: Q78623

1.00

WINDOWS

buglist1.00

Summary:

PROBLEM ID: QCW9111002

SYMPTOMS

Attempting to use the LEA instruction on a non-integer variable in

inline assembly causes Microsoft C versions 6.0, 6.0a, and 6.0ax,

Microsoft QuickC versions 2.5 and 2.51, and Microsoft QuickC for

Windows (QC/Win) version 1.0 to return the message:

Warning C4410: illegal size for operand

RESOLUTION

The warning message listed above can be avoided by qualifying the

reference to the non-integer variable as a WORD PTR. The sample

code listed below illustrates this method.

STATUS

Microsoft has confirmed this to be a problem with Microsoft

C versions 6.0, 6.0a, and 6.0ax (buglist6.00, buglist6.00a,

buglist6.00ax), Microsoft QuickC versions 2.5 and 2.51

(buglist2.50, buglist2.51), and Microsoft QC/Win version 1.0. We

are researching this problem and will post new information here as

it becomes available.

More Information:

Even though the compiler generates the C4410 warning message, the

underlying code generated by the compiler is correct. This can be seen

by either running the program under the CodeView debugger, or by

generating a code listing from the compiler with the /Fc command-line

option.

Sample Code

-----------

/* Compile options needed: none

*/

void main (void)

{

long A_Non_int_Variable;

/*

* To avoid the C4410 warning, change the following line

* of code to use the qualified type of WORD PTR. For example:

*

* _asm lea bx, WORD PTR A_Non_int_Variable

*/

_asm lea bx, A_Non_int_Variable;

}

Additional reference words: 1.00 2.50 6.00 6.00a 6.00ax