Divide by zero error on SPARC/Linux. - Mailing list pgsql-hackers

From Keith Parks
Subject Divide by zero error on SPARC/Linux.
Date
Msg-id 199806221940.UAA26723@mtcc.demon.co.uk
Whole thread Raw
Responses Re: [HACKERS] Divide by zero error on SPARC/Linux.  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
Hi All,

In the latest CVS I can get the backend to terminate quite
easily with a divide by 0.

postgres=> select 1/0;
pqReadData() -- backend closed the channel unexpectedly.
        This probably means the backend terminated abnormally before or while
processing the request.
We have lost the connection to the backend, so further processing is impossible.
 Terminating.
[postgres@sparclinux pgsql]$

A bt on the core shows:-

Program received signal SIGILL, Illegal instruction.
0xe0155718 in .div ()
(gdb) bt
#0  0xe0155718 in .div ()
#1  0xc6bcc in int4div (arg1=1, arg2=0) at int.c:523

I don't know if this is recently introduced behaviour or if
it's platform dependant. I can't recall trying this before
so maybe it's always happened on S/Linux.

My immediate thought is to include a check for divide by 0
in the intXXdiv() functions and do something like an elog(WARN,...)

Firstly, what do other people get on their platform?

Keith.


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Problem after removal of exec(), help
Next
From: David Schanen
Date:
Subject: Re: btree: BTP_CHAIN flag was expected (revisited)