From: Tom Lane <tgl@sss.pgh.pa.us>
To: Martin Pitt <mpitt@debian.org>
Cc: PostgreSQL Bugs <pgsql-bugs@postgresql.org>
Cc: Aurelien Jarno <aurel32@debian.org>
Cc: 616180@bugs.debian.org
Subject: Re: [patch] test failure on sparc64 due to undefined division by zero behaviour
Date: Fri, 11 Mar 2011 17:53:02 -0500
Message-ID: <258.1299883982@sss.pgh.pa.us> (raw)
In-Reply-To: <20110311174710.GF2541@piware.de>
References: <20110311174710.GF2541@piware.de>
Martin Pitt <mpitt@debian.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, mpitt@debian.org, aurel32@debian.org, 616180@bugs.debian.org
Subject: Re: [patch] test failure on sparc64 due to undefined division by zero behaviour
In-Reply-To: <258.1299883982@sss.pgh.pa.us>
References: <20110311174710.GF2541@piware.de> <258.1299883982@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox