[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gsl] gsl_complex_rect error in Windows
From: |
Meng-Yuan Huang |
Subject: |
[Bug-gsl] gsl_complex_rect error in Windows |
Date: |
Mon, 11 Aug 2008 15:48:39 +0800 |
It seems that I found a bug in GSL.
My Environment:
CPU: Intel Pentium 4
OS: Windows XP SP3
Compilers: Visual C++ 6.0, MinGW gcc 3.4.2
I used this gsl build:
http://gnuwin32.sourceforge.net/packages/gsl.htm
and even I compiled gsl-1.11 by MinGW by myself.
However, I got the same error when I ran this small program:
------------------------------------------------------------------------------
#include <gsl/gsl_complex_math.h>
void a()
{
gsl_complex_rect(0, 1);
}
int main()
{
a();
return 0;
}
------------------------------------------------------------------------------
This is the error screenshot:
http://p8.p.pixnet.net/albums/userpics/8/3/553683/1218439640.png
I've look the assembly codes in Visual C++ and Code::Blocks.
The function gsl_complex_rect incorrectly modifies ESP (stack pointer) register
with a "ret 4" instruction after returning from gsl_complex_rect(0, 1).
However, Visual C++ and MinGW think the calling convention of gsl_complex_rect
function as cdecl.
In fact, cdecl functions have the return instructions "ret", not "ret 4."
So, in debug mode, Visual C++ caught the error.
In debug mode in Code::Blocks, I got the same wrong modification of ESP.
And gsl_complex_polar has the same problem.
Do anyone know how to solve this problem?
Thanks.
- [Bug-gsl] gsl_complex_rect error in Windows,
Meng-Yuan Huang <=