bugGNU Scientific Library - Bugs: bug #49518, bug in matrix/vector tests

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #49518: bug in matrix/vector tests

Submitter:  Patrick Alken <psa>
Submitted:  Wed 02 Nov 2016 07:37:24 PM UTC
 
Category:  Build Severity:  3 - Normal
Operating System:  Status:  None
Assigned to:  None Open/Closed:  Open
Release: 

Wed 02 Nov 2016 07:37:24 PM UTC, original submission:  

from kmb2718 =at= gmail =dot= com

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

Patrick Alken <psa>
Project Administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psa (Submitted the item)
  •  

     

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.9