BUG: Error C1001: _asm Instruction Accessing Stack Using [ebp]Last reviewed: July 24, 1997Article ID: Q150572 |
The information in this article applies to:
SYMPTOMSInline assembly code that uses [ebp] to gain access to arguments or local variables on the stack results in this error:
fatal error C1001: INTERNAL COMPILER ERROR (compiler file '\school.tp3\test\c10\src\P2\386\codegen.c', line 4040) CAUSEWhen an argument is passed to a function, or a local variable is declared in a function, the argument or variable is placed on the stack, and is already referenced in terms of [ebp]. When [ebp] is used explicitly to reference that argument or variable as in ccb[ebp], for example, the compiler adds [ebp] again, resulting in an illegal address. The compiler fails to catch this as a meaningful error, and instead generates error C1001.
RESOLUTIONDo not attempt to gain access to stack arguments or variables in terms of [ebp]. NOTE: In the sample code in this article, lcb[ebp] and ccb[ebp] are invalid references; lcb and ccb need to be referenced directly. Otherwise, the compiler does not catch the illegal reference.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Sample Code
/* Compile options needed:none */ #include <windows.h> void masmfunc(DWORD ccb){ _asm mov eax ,dword ptr ccb[ebp]; //C1001 //Or, // DWORD lcb = 20; // _asm mov eax ,dword ptr lcb[ebp]; //C1001 } |
Keywords : CLIss kbprg vcbuglist400 vcbuglist500
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |