mpf_div Bug in MSVC GMP-4.1.2 and GMP-4.1.3

Mike Loehr michael635 at adelphia.net
Tue Aug 3 04:01:39 CEST 2004


Greetings;

There seems to be an error in the mpf_div function under MSVC.

If I send it 2 positive numbers, it works fine, but if I send a negative of
one of the same numbers it crashes.

The message is:  The instruction at "0x73dd1351" referenced memory at
"0x00000004", The memory could not be "read".

I have tried the binaries from several sources and also compiled my own
gmp.dll using the Core_V1.6  revisions.
There is no change in the functionality or the result. (Trinity's Pentium
version didn't allow the application to function although it linked without
errors)

Other mpf functions work (i.e. mpf_mul, mpf_init, mpf_sub) so I believe that
the DLLs are all functional.

Here's the snip of code:
  
  mpf_t n , d ;
  mpf_t nn1x , nn1y , nn1z ;
  
  mpf_init (n);
  mpf_init (d);
  mpf_init (nn1x);
  
/*  Test Code */
  mpf_set_d ( n , 1228.07 );  // N1[0] = -1228.07
  mpf_set_d ( d , 1081035.19771 ); // D1
  mpf_div ( nn1x , n , d );  //  This works
/*  End Test Code */

  mpf_set_d ( n , N1[0] );   // N1[0] = -1228.07

  mpf_set_d ( d , D1 );  // D1 = 1081035.19771 
/*  Test Code */
  printf("\nGMP  n = %f   d= %f ", mpf_get_d(n) , mpf_get_d(d));  //
Confirms n = 1228.07 & d = 1081035.19771 
/*  End Test Code */

  mpf_div ( nn1x , n , d );  //  This fails with or without the previous
test set code

 

Here's the System Data:

Compiler			MSVC 6 SP-5
Build Settings			/nologo /G5 /MD /W3 /Ox /Op /D "_WIN32" /D
"WIN32" /D "NATIVE_WIN32"
				/D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D
"_AFXDLL" /D "_MBCS" 
				/D "_USRDLL" /YX  /Fo"Release/"
/Fd"Release/" /FD /GF /c 

OS Name			Microsoft Windows XP Professional
				Version	5.1.2600 Service Pack 1 Build 2600
OS Manufacturer		Microsoft Corporation
System Manufacturer		Intel
System Model			S2440BX
System Type			X86-based PC
Processor			x86 Family 6 Model 8 Stepping 3 GenuineIntel
~798 Mhz
BIOS Version/Date		Intel Corp. 4S4EB2X0.86A.0024.P17, 8/17/2000
Total Physical Memory		384.00 MB
Available Physical Memory	107.10 MB
Total Virtual Memory		1.28 GB
Available Virtual Memory		767.24 MB
Page File Space		923.10 MB

I'm building an application that is implemented as a DLL.  This
configuration compiles against GLib and GTS (all recent versions)
successfully in the same application.

Any assistance that you can provide will be appreciated.  I hope I haven't
missed something, I hate being a bonehead.

Thanks

Mike

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 2948 bytes
Desc: not available
Url : /list-archives/gmp-bugs/attachments/20040802/c6fbab50/winmail.bin


More information about the gmp-bugs mailing list