Stack overflow on windows with mrtd flag

21 views
Skip to first unread message

John McFarland

unread,
Sep 3, 2009, 6:54:09 PM9/3/09
to gg95
The below test program demonstrates a stack overflow exception on
Windows when compiled with the -mrtd flag:
--------------------------------------------------------------------------
PROGRAM prog

INTEGER, PARAMETER :: n=1000000
REAL*8 :: x(n,4)
REAL*8 :: y(4) ! See notes below
INTEGER :: i

DO i=1,n
x(i,:) = [1d0,2d0,3d0,4d0]
END DO

END PROGRAM prog
--------------------------------------------------------------------------
All indications are that this is a compiler bug, as replacing the line
inside the loop with either of the following makes the exception go
away:
(a): x(i,:) = y
(b): y = [1d0,2d0,3d0,4d0]

I have already reported this to Andy (several months ago) but have not
heard back from him since sending him the assembler output. I just
wanted to see if anyone else might be able to help with this. While
the above test program obviously does nothing but demonstrate the bug,
I have several larger more useful programs for which this particular
bug is causing me a lot of frustration.

Thanks,
John

Michael

unread,
Sep 4, 2009, 6:01:46 AM9/4/09
to gg95
John
I was able to reproduce the stack overflow with the -mrtd flag. I was
wondering though why you would use this flag. I was under the
impression that this flag is used for compiling DLLs.
On the subject of the g95 web site I myself wondering what happend to
Andy. Also no word from Doug

Michael

John McFarland

unread,
Sep 4, 2009, 9:47:16 AM9/4/09
to gg95
Hi Michael, thanks for the reply. Actually, you are right, my
original post was not completely correct: the frustration I mention
has to do with using the flag to compile a shared library (DLL), not a
program. In fact what I have done is create an Excel spreadsheet that
directly calls functions defined in the DLL. The -mrtd flag is needed
when interfacing with Excel b/c Excel uses STDCALL.

John
Reply all
Reply to author
Forward
0 new messages