BUG: Huge Array in C++ App May Cause General Protection FaultID: Q102679
|
An attempt to run an application developed in C++ for the Microsoft Windows operating system may fail and cause a general protection (GP) fault when the application accesses a huge array. If you create and run a version of the application for the MS-DOS operating system using the fast compiler, other errors may occur or the machine may hang. A similar application developed in C compiles and runs without error.
The fast compiler does not correctly create the far data segments required to support a huge array in a C++ application.
Modify the compiler command line to specify the /f- compiler option switch to build the application with the optimizing compiler.
Microsoft has confirmed this to be a problem in C/C++ compiler versions 7.0, 8.0, and 8.0c for MS-DOS. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
Microsoft C/C++ version 7.0 and the Professional Edition of Visual C++
include the optimizing compiler. To build an application with the
optimizing compiler, specify the /f- compiler option switch or perform
the following three steps to modify options in Visual Workbench:
/*
* Compiler options needed: /AL
* Linker options recommended: /MAP
*/
long __huge array[64000L];
void main(void)
{
long i;
for (i = 0; i < 64000L; i++)
array[i] = i;
}
Additional query words: 7.00 8.00 8.00c 1.00 1.50 gp-fault link initialize
Keywords : kb16bitonly
Version :
Platform :
Issue type :
Last Reviewed: July 22, 1999