Re: Test suite fails on alpha architecture - Mailing list pgsql-bugs

From Falk Hueffner
Subject Re: Test suite fails on alpha architecture
Date
Msg-id 87mytp982s.fsf@debian.org
Whole thread Raw
In response to Re: Test suite fails on alpha architecture  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Test suite fails on alpha architecture  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Tom Lane <tgl@sss.pgh.pa.us> writes:

> All the other diffs that Martin showed are divide-by-zero failures,
> and I do not see any of them on Gentoo's machine.  I think that this
> must be a compiler bug.  The first example in his diffs is just
> "select 1/0", which executes this code:
>
>     int32        arg1 = PG_GETARG_INT32(0);
>     int32        arg2 = PG_GETARG_INT32(1);
>     int32        result;
>
>     if (arg2 == 0)
>         ereport(ERROR,
>                 (errcode(ERRCODE_DIVISION_BY_ZERO),
>                  errmsg("division by zero")));
>
>     result = arg1 / arg2;
>
> It looks to me like Debian's compiler must be allowing the division
> instruction to be speculatively executed before the if-test branch
> is taken.  Perhaps it is supposing that this is OK because control
> will return from ereport(), when in fact it will not (the routine
> throws a longjmp).  Since we've not seen such behavior on any other
> platform, however, I suspect this is just a bug and not intentional.

Can you create a stand-alone testcase for this?

--
    Falk

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_get_indexdef excludes tablespace info
Next
From: Tom Lane
Date:
Subject: Re: Test suite fails on alpha architecture