Microsoft KB Archive/119873

= FIX: Incorrect Use of #pragma Pack Causes C1001 Errors =

Article ID: 119873

Article Last Modified on 7/5/2005

-

APPLIES TO


 * Microsoft Visual C++ 1.0 Professional Edition
 * Microsoft Visual C++ 2.0 Professional Edition
 * Microsoft Visual C++ 4.0 Standard Edition
 * Microsoft Visual C++ 4.1 Subscription
 * Microsoft Visual C++ 4.2 Professional Edition
 * Microsoft Visual C++ 5.0 Standard Edition
 * Microsoft Visual C++ 6.0 Service Pack 5

-



This article was previously published under Q119873



SYMPTOMS
When compiling code that uses #pragma pack to pop an ID that has not been pushed after successfully popping an ID that was pushed, the compilers listed above will generate:

fatal error C1001: INTERNAL COMPILER ERROR

In addition, this error will be followed by a message similar to

(compiler file 'msc1.cpp', line 902)

Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information

NOTE: In Microsoft Visual Studio .NET, you receive a C4160 warning instead of the error message, so you can compile and run the program.



RESOLUTION
Pop only IDs that have been previously pushed onto the compiler's internal stack.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This problem was corrected in Microsoft Visual C++ .NET.



MORE INFORMATION
The following sample code demonstrates the bug:

Sample Code
/* packfail.c

Compile options needed: none


 * 1) pragma pack(push, a)
 * 2) pragma pack(push, b, 4)
 * 3) pragma pack(pop, b)
 * 4) pragma pack(pop, value)

Additional query words: kbVC400bug 8.00 9.00 buglist1.00 buglist2.00 buglist8.00 buglist9.00 10.00 10.10 10.20

Keywords: kbbug kbfix kbnoupdate kbcompiler KB119873

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.