| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Martin Pitt <mpitt(at)debian(dot)org> |
| Cc: | PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>, Aurelien Jarno <aurel32(at)debian(dot)org>, 616180(at)bugs(dot)debian(dot)org |
| Subject: | Re: [patch] test failure on sparc64 due to undefined division by zero behaviour |
| Date: | 2011-03-11 22:53:02 |
| Message-ID: | 258.1299883982@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Martin Pitt <mpitt(at)debian(dot)org> writes:
> The C99 standard [2], section 6.5.5 paragraph 5 actually says:
> "The result of the / operator is the quotient from the division of
> the first operand by the second; the result of the % operator is the
> remainder. In both operations, if the value of the second operand is
> zero, the behavior is undefined."
> so the gcc folk's claim that this isn't a gcc bug looks justified.
The gcc guys are full of it. The issue that is relevant here is the C
standard's definition of sequence points, and in particular the
requirement that visible side effects of a later statement cannot happen
before the execution of an earlier function call. The last time I
pestered them about this, I got some lame claim that a SIGFPE wasn't a
side effect within the definitions of the spec. At that point useful
discussion stopped, because it's impossible to negotiate with someone
who's willing to claim that.
> Aurelien sent a straightforward patch for this, I updated it to apply
> to current git head, updated the comments, and git-formatted it.
Hmm ... I'm willing to put in the extra return statements, but not to
remove the comments that we're working around a gcc bug. In particular,
given the gcc folks' claim that they need not consider the timing of
program-generated signals, there is really nothing to stop them from
trying to push the division up before the return too. This is nothing
but a band-aid for a non-standards-compliant optimizer.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Vishal | 2011-03-12 07:31:52 | Re: BUG #5927: PostgreSQL8.2 |
| Previous Message | Tom Lane | 2011-03-11 22:31:32 | Re: Collation problem right from AbstractJdbc2DatabaseMetaData.getTables |