Edit: See end of question for updated answer.
I spent several weeks tracking a very strange bug in the software part I support. In short, there is an old piece of software that is in distribution and new software that must match the old. These two theories (in theory) rely on a common library [1]. However, I cannot duplicate the results generated by the original version of the library, even if the source for the two versions of the library is the same. The real code is very simple. The original version looked like this ("voodoo" commented this is not mine): [2]
void my_function() {
double tt, p1, p2, t2;
char *ptr;
ptr = NULL;
p2 = 0.0;
t2 = 0.0;
tt = (double) rstr[20];
p1 = (double) rstr[8];
}
, , - .
, rstr[8] 101325.,
double [3] , p1 101324.65625. , tt
373.149999999996.
, (
). ,
.
(
), ( tt)
. , p1 101325.0,
rstr[8]. , ,
, p1.
, :
#include "the_header.h"
float rstr[101];
int main() {
rstr[8] = 101325.;
rstr[20] = 373.15;
my_function();
}
, VC6.
4550: tt = (double) rstr[20];
0042973F fld dword ptr [rstr+50h (006390a8)]
00429745 fstp qword ptr [ebp-0Ch]
4551: p1 = (double) rstr[8];
00429748 fld dword ptr [rstr+20h (00639078)]
0042974E fstp qword ptr [ebp-14h]
, VC6
( , VC6
):
60: tt = (double) rstr[20];
00408BC8 fld dword ptr [_rstr+50h (0045bc88)]
00408BCE fstp qword ptr [ebp-0Ch]
61: p1 = (double) rstr[8];
00408BD1 fld dword ptr [_rstr+20h (0045bc58)]
00408BD7 fstp qword ptr [ebp-14h]
, , ,
, _
rstr . , VC6
,
. ,
,
, , -.
, (
) , Win32 MFC,
- , MFC.
,
C.
.
: , , , / , , , , , , . - .
- , , , , - , , , , , , rstr[8], , double , , .
, , , . , rstr[8] GUI ( ), , . , 101325.0, , , 1.01325e5.
. Eric Postpischil unwind , . .
- ""
, .
#include,
, extern.
, ,
. - , , .
, .
/* voooooodoooooooooo */, ...
... . ,
Fortran
- .
. - , ,
, .