Without further introduction, consider the following:
[1] BUILD.STEVED:print datetest.c
/* intrinsic stuff deleted for brevity */
#define DATEFORMAT_HPCALENDAR 4
#define DATEFORMAT_YYYYMMDDASC 38
#define DATEFORMAT_YYYYMMDDINT 18
#define DATEFORMAT_YYMMDDASC 25
#define DATEFORMAT_YYMMDDINT 15
#define DATEFORMAT_CALENDAR 14
#ifdef __mpexl
#pragma HP_ALIGN NOPADDING
#else
#pragma pack(1)
#endif
/* MPE intrinsic status return structure */
typedef struct {
short info;
short subsys;
} MPESTATUS;
int main()
{
int i;
int currdate;
int changedate;
currdate = HPCALENDAR();
changedate = currdate - 50;
for (i = 1; i < INT_MAX / 2 - 1; i <<= 1)
{
unsigned int guard1 = 123456789;
int DateDiff;
unsigned int guard2 = 198765432;
MPESTATUS inputstatus;
unsigned int guard3 = 135792468;
MPESTATUS mpestatus;
unsigned int guard4 = 192837465;
*(int*)&mpestatus = i - 1;
*(int*)&inputstatus = i - 1;
DateDiff = *(int*)&mpestatus ^ currdate;
HPDATEDIFF(DATEFORMAT_HPCALENDAR, &changedate, &currdate,
&DateDiff, &mpestatus, -1);
printf("%9.9u %9.9d %9.9u %05d.%05d %9.9u %05d.%05d %9.9u\n",
guard1, DateDiff, guard2, inputstatus.info,
inputstatus.subsys,
guard3, mpestatus.info, mpestatus.subsys, guard4);
fflush(stdout);
}
return 0;
}
#ifdef __mpexl
#pragma HP_ALIGN POP
#else
#pragma pack()
#endif
[1] BUILD.STEVED:exdatst
guard1 DateDiff guard2 InStat guard3 OutStat guard4
123456789 000000050 198765432 00000.00000 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.00001 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.00003 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.00007 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.00015 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.00031 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.00063 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.00127 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.00255 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.00511 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.01023 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.02047 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.04095 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.08191 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.16383 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.32767 135792468 00000.00000
192837465
123456789 000000050 198765432 00000.-0001 135792468 00000.00000
192837465
123456789 000000050 198765432 00001.-0001 135792468 00001.00529
192837465
123456789 000000050 198765432 00003.-0001 135792468 00003.00529
192837465
123456789 000000050 198765432 00007.-0001 135792468 00007.00529
192837465
123456789 000000050 198765432 00015.-0001 135792468 00015.00529
192837465
123456789 000000050 198765432 00031.-0001 135792468 00031.00529
192837465
123456789 000000050 198765432 00063.-0001 135792468 00063.00529
192837465
123456789 000000050 198765432 00127.-0001 135792468 00127.00529
192837465
123456789 000000050 198765432 00255.-0001 135792468 00255.00529
192837465
123456789 000000050 198765432 00511.-0001 135792468 00511.00529
192837465
123456789 000000050 198765432 01023.-0001 135792468 01023.00529
192837465
123456789 000000050 198765432 02047.-0001 135792468 02047.00529
192837465
123456789 000000050 198765432 04095.-0001 135792468 04095.00529
192837465
123456789 000000050 198765432 08191.-0001 135792468 08191.00529
192837465
Hmmm.
We discovered this after updating to PP5 over the weekend. After rebuilding
some modules for testing, the "is your password expired?" logic (written in
Transact/iX) started returning a failed status 100% of the time. The above is
the culmination of the investigation.
It looks to me like:
1) HPDATEDIFF is only returning 16 bits of the status parameter, and the
"wrong" 16 bits at that, i.e. the ".subsys" member. It does not appear to be
returning a misaligned 32 bits, since none of the guard values were changed.
2) It looks like it is also misreading the input, since a change in the
".info" member of the output-status parameter on input causes a change in the
returned status value.
RC Call ID A5333372 refers. But we haven't heard back from them yet, so we
don't know if this already known or not. Anyone seen this one?
Steve Dirickson WestWin Consulting
(360) 598-6111 [log in to unmask]
|