FIX: Error C1001: _asm Instruction Accessing Stack Using [ebp] (150572)
The information in this article applies to:
- Microsoft Visual C++ 2.0
- Microsoft Visual C++ 2.1
- Microsoft Visual C++ 2.2
- Microsoft Visual C++ 4.0
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q150572 SYMPTOMS
Inline 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)
CAUSE
When 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.
RESOLUTION
Do 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.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
This problem was corrected in Microsoft Visual C++ 6.0 Service Pack 5.
Modification Type: | Major | Last Reviewed: | 12/2/2003 |
---|
Keywords: | kbBug kbCompiler kbfix kbNoUpdate KB150572 |
---|
|