Package: postgresql-9.0
Version: 9.0.3-1
Severity: important
Tags: patch
User: debian-sp...@lists.debian.org
Usertags: sparc64

postgresql-9.0 fails to build on sparc64 due to testsuite errors with 
int8. The division by 0 is not trapped and a SIGFPE is issued instead of
an error.

Postgresql people claims it's a gcc bug, while gcc people says the code
is incorrect [1]. Whatever the real issue is, the fix is very simple 
(actually taken in another part from the very same file), so it's 
probably the best to simply apply it.

[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29968


--- postgresql-9.0-9.0.3.orig/src/backend/utils/adt/int8.c
+++ postgresql-9.0-9.0.3/src/backend/utils/adt/int8.c
@@ -592,9 +592,13 @@ int8div(PG_FUNCTION_ARGS)
        int64           result;
 
        if (arg2 == 0)
+       {
                ereport(ERROR,
                                (errcode(ERRCODE_DIVISION_BY_ZERO),
                                 errmsg("division by zero")));
+               /* ensure compiler realizes we mustn't reach the division (gcc 
bug) */
+               PG_RETURN_NULL();
+       }
 
        result = arg1 / arg2;
 
@@ -815,9 +819,13 @@ int84div(PG_FUNCTION_ARGS)
        int64           result;
 
        if (arg2 == 0)
+       {
                ereport(ERROR,
                                (errcode(ERRCODE_DIVISION_BY_ZERO),
                                 errmsg("division by zero")));
+               /* ensure compiler realizes we mustn't reach the division (gcc 
bug) */
+               PG_RETURN_NULL();
+       }
 
        result = arg1 / arg2;
 
@@ -999,9 +1007,13 @@ int82div(PG_FUNCTION_ARGS)
        int64           result;
 
        if (arg2 == 0)
+       {
                ereport(ERROR,
                                (errcode(ERRCODE_DIVISION_BY_ZERO),
                                 errmsg("division by zero")));
+               /* ensure compiler realizes we mustn't reach the division (gcc 
bug) */
+               PG_RETURN_NULL();
+       }
 
        result = arg1 / arg2;
 


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: sparc64

Kernel: Linux 2.6.32-bpo.5-sparc64-smp (SMP w/32 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to