The following bug has been logged online:
Bug reference: 2778
Logged by: Alex Deiter
Email address: tiamat@komi.mts.ru
PostgreSQL version: 8.1.5
Operating system: Solaris 9 sparc
Description: make check failed
Details:
System detail:
Solaris 9 sparc, gcc 4.0.2, 4.1.1:
$ ./configure --enable-thread-safety --disable-nls --without-perl
--without-python --without-krb5 --without-openssl --without-readline
...
$ make && make check
...
=======================
1 of 98 tests failed.
=======================
The differences that caused some tests to fail can be viewed in the
file `./regression.diffs'. A copy of the test summary that you see
above is saved in the file `./regression.out'.
$ less src/test/regress/regression.diffs
*** ./expected/errors.out Sat Feb 12 01:15:11 2005
--- ./results/errors.out Thu Nov 23 18:14:08 2006
***************
*** 300,308 ****
select 1/0::int8;
ERROR: division by zero
select 1::int2/0;
! ERROR: division by zero
select 1/0::int2;
! ERROR: division by zero
select 1::numeric/0;
ERROR: division by zero
select 1/0::numeric;
--- 300,310 ----
select 1/0::int8;
ERROR: division by zero
select 1::int2/0;
! ERROR: floating-point exception
! DETAIL: An invalid floating-point operation was signaled. This probably
means
an out-of-range result or an invalid operation, such as division by zero.
select 1/0::int2;
! ERROR: floating-point exception
! DETAIL: An invalid floating-point operation was signaled. This probably
means
an out-of-range result or an invalid operation, such as division by zero.
select 1::numeric/0;
ERROR: division by zero
select 1/0::numeric;
======================================================================
i found cause of this error:
#include <stdio.h>
int testdiv(int i, long k) {
if (k == 0) printf("found divide by zero\n");
return(i/k);
}
int main() {
int i = testdiv(1,0);
return(i);
}
when compile it without optimization, it works fine:
$ gcc t.c
$ ./a.out
found divide by zero
Arithmetic Exception (core dumped)
but optimization break it:
$ gcc -O3 t.c
$ ./a.out
Arithmetic Exception (core dumped)
Thanks a lot!