Thread: compilation test fails
Hi,
I have compiled 8.3.7 on HP-Itanium
After the build I have continued to the tests (gmake check)
One of the tests failed (division by zero error test)
The regression.diffs file shows the diff regarding of the expected result and the actual result:
*** ./expected/errors.out Sat Nov 10 16:36:44 2007
--- ./results/errors.out Thu May 21 10:15:15 2009
***************
*** 304,310 ****
select 1/0;
ERROR: division by zero
select 1::int8/0;
! ERROR: division by zero
select 1/0::int8;
ERROR: division by zero
select 1::int2/0;
--- 304,311 ----
select 1/0;
ERROR: division by zero
select 1::int8/0;
! ERROR: floating-point exception
! DETAIL: An invalid floating-point operation was signaled. This probably means an out-of-range result or an invalid operatio
n, such as division by zero.
select 1/0::int8;
ERROR: division by zero
select 1::int2/0;
======================================================================
Can you help?
Regards,
Yuval Sofer
BMC Software
CTM&D Business Unit
DBA Team
972-52-4286-282
yuval_sofer@bmc.com
"Sofer, Yuval" <Yuval_Sofer@bmc.com> writes: > I have compiled 8.3.7 on HP-Itanium > After the build I have continued to the tests (gmake check) > One of the tests failed (division by zero error test) Hm, what compiler and what optimization level? We have seen a report or two about this before, all from people using gcc on non-mainstream architectures. So far as I can tell it's a compiler bug. The code in int84div looks like int64 arg1 = PG_GETARG_INT64(0); int32 arg2 = PG_GETARG_INT32(1); int64 result; if (arg2 == 0) ereport(ERROR, (errcode(ERRCODE_DIVISION_BY_ZERO), errmsg("division by zero"))); result = arg1 / arg2; and the only way to get the behavior you're showing is if the division is executing (and causing a trap) before control is passed to ereport(). So apparently the compiler is forgetting that division can have a side effect (ie machine trap) and thinking it's safe to reorder the operations. regards, tom lane