[Pixman] Fwd: make error on pixman library

Søren Sandmann sandmann at cs.au.dk
Sat Dec 15 07:42:25 PST 2012

Søren Sandmann <sandmann at cs.au.dk> writes:

>> /bin/bash: line 5:  5532 Floating point exception${dir}$tst
>> FAIL: combiner-test

I managed to reproduce this using the -m32 option to gcc. The problem is
a divide-by-zero in blend_color_dodge():

        static force_inline float
        blend_color_dodge (float sa, float s, float da, float d)
            if (d == 0.0f)
                return 0.0f;
            else if (d * sa >= sa * da - s * da)
                return sa * da;
            else if (sa - s == 0.0f)
                return sa * da;
                return sa * sa * d / (sa - s);

The division is guarded by

    if (sa - s == 0.0f)
        .... / (sa - s);

which in theory should be correct, but isn't with the combination of x87
and gcc optimizations. The following patch fixes the issue by changing
the comparision for equality with zero into a comparision for the
interval -FLT_MIN, FLT_MIN.


More information about the Pixman mailing list