bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] Bug in the Matrix/Vector Testing Routines


From: Bong Kim
Subject: [Bug-gsl] Bug in the Matrix/Vector Testing Routines
Date: Wed, 2 Nov 2016 20:02:33 +0900

Hi !



I found a bug in matrix and vector testing routines under MS Visual Studio
64bit build.

To open a temporary file, following code is used in some test routines.

===================================================

char filename[] = "test.XXXXXX";

#if !defined( _WIN32 )

  int fd = mkstemp(filename);

#else

  char * fd = _mktemp(filename);

# define fdopen fopen

#endif

===================================================

Under MS Visual Studio, _mktemp() is used without its function declaration
because the declaration resides in <io.h>.

 At compile time, the function is treated as an integer returning function
but it return an address of the filename string.

Under 64bit build condition, test programs using above code crashes due to
pointer value truncation (64bit pointer -> 32bit integer -> 64bit pointer
???).


To prevent this problem, test.c for vector or matrix needs to include
<io.h> as follows.

===================================================

#ifdef _WIN32

#include <io.h>

#endif

===================================================



_mktemp() is used in following files.

           gsl/matrix/test_complex_source.c

           gsl/matrix/test_source.c

           gsl/spmatrix/test.c

           gsl/vector/test_complex_source.c

           gsl/vector/test_source.c



Best Regards,

KB


reply via email to

[Prev in Thread] Current Thread [Next in Thread]