[Pixman] [PATCH] Resolve implementation-defined behaviour for division rounded to -infinity

Siarhei Siamashka siarhei.siamashka at gmail.com
Wed Aug 26 08:40:14 PDT 2015


On Wed, 26 Aug 2015 07:34:13 -0700
Alan Coopersmith <alan.coopersmith at oracle.com> wrote:

> On 08/26/15 06:21 AM, Ben Avison wrote:
> > No, but I'd have thought it was bad practice to assume C99 behaviour when
> > compiling C89.
> 
> Perhaps the AC_PROG_CC_C99 macro should be added to the pixman/configure.ac
> to avoid that then.

If we start compiling pixman in C99 mode by default, then this will make
it harder for us to identify potential C89 compatibility issues. One of
such recurring issues in the past were the cases of doing variable
declaration in the middle of code:

    http://lists.freedesktop.org/archives/pixman/2013-October/003033.html
    http://lists.freedesktop.org/archives/pixman/2013-September/002954.html

We got this under control by using the -Wdeclaration-after-statement
option in order to at least issue a compilation warning:

    http://cgit.freedesktop.org/pixman/commit/?id=9e81419ed5c0ee490ddacf7bada516a25cae87eb

And as explained to Ben in my previous message, pixman currently
relies on certain implementation defined behaviour, which happens
to be implemented in the same predictable way on all the known
systems in the world (maybe excluding some museum exhibits or really
oddball special-purpose hardware). We are not relying on undefined
behaviour, which is a totally different matter. And we have an
extensive test suite in place, which exists to ensure that the
compiled pixman library behaves in the intended way. This also
includes verifying that our current assumptions about the
implementation defined behaviour are satisfied on every target
system.

Basically, there is no real problem to solve (yet). And we are well
prepared to deal with the theoretical problems if they ever get
discovered in practice.

For example, I really would not like to see anyone getting inspired
by this discussion thread and going on a crusade against the two's
complement signed integer representation assumptions.

-- 
Best regards,
Siarhei Siamashka


More information about the Pixman mailing list