Microsoft KB Archive/106520

= FIX: /Ge Fails to Detect Stack Overflow =

Article ID: 106520

Article Last Modified on 10/24/2003

-

APPLIES TO


 * Microsoft FORTRAN PowerStation 1.0 Standard Edition
 * Microsoft Fortran PowerStation 1.0a for MS-DOS
 * Microsoft FORTRAN PowerStation 32

-



This article was previously published under Q106520



SYMPTOMS
Programs compiled with the /Ge option produce the following run-time error

DOSXMSF : fatal error DX1020: unhandled exception: General protection fault;

when a stack overflow occurs, instead of the expected R6000 stack overflow message.



STATUS
Microsoft has confirmed this to be a problem in FORTRAN PowerStation version 1.0 for MS-DOS. This problem was corrected in Microsoft FORTRAN PowerStation 32, version 4.0.



MORE INFORMATION
The stack-checking routine enabled by the /Ge option does not detect stack overflow. Because the default stack size for the FORTRAN PowerStation is 32K, a general protection (GP) fault is unlikely to be caused by a stack overflow. The exception to this is when one of the following types of programs is written:


 * Programs deliberately designed to use up the stack. This would involve extensive use of automatic variables, indirect recursion, or deeply nested subroutine and function calls totaling thousands of passed arguments.
 * Programs that circumvent the link time check for stack use based on name decorations. These programs may cause stack overflow if they contain problems related to passing arguments. This check is circumvented by declaring the routine to use the C or VARYING calling conventions or by using the ALIAS attribute.
 * Programs that call Assembly language routines that incorrectly use the stack.

Sample Code
The following code can be used to illustrate the problem: C Compile options needed: /Ge subroutine recur(y) integer y     y = y + 1 call indrec(y) end subroutine indrec(i) integer i     i = i + 1 call recur(i) end integer x     x = 0 call recur(x) end NOTE: The /Ge compiler option is no longer used for stack-probe checks under FORTRAN PowerStation 32, version 4.0. Attempting to use this option will generate the message:

Command line warning D2004: obsolete option /Ge ignored.

Additional query words: 1.00 gpf gp-fault

Keywords: kberrmsg kbbug kbfix kblangfortran KB106520

-

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

© Microsoft Corporation. All rights reserved.