[cairo-bugs] [Bug 4401] New: cairo detects and uses buggy sincos() on Tru64, cairo_matrix_init_rotate

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Sep 8 15:31:41 PDT 2005


Please do not reply to this email: if you want to comment on the bug, go to    
       
the URL shown below and enter yourcomments there.     
   
https://bugs.freedesktop.org/show_bug.cgi?id=4401          
     
           Summary: cairo detects and uses buggy sincos() on Tru64,
                    cairo_matrix_init_rotate
           Product: cairo
           Version: 1.0.0
          Platform: DEC
        OS/Version: OSF/1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: general
        AssignedTo: cworth at cworth.org
        ReportedBy: enchanter at users.sourceforge.net
         QAContact: cairo-bugs at cairographics.org


cairo's configure detects that Tru64 has some symbol named sincos(), so it uses
it in cairo_matrix_init_rotate().  sincos isn't documented on Tru64 and I can't
find anything about it in any of the headers, so it's not even at the level of
"deprecated" or "obsolete" interface.

Using sincos() causes problems (SIGFPE, floating point exception) for tests like
transforms, and likely causes problems in real-world code too, because the
values that get filled into the cairo_matrix_t by cairo_matrix_init_rotate()
likely trigger underflow:


(ladebug) list
    560 }
    561 
    562 cairo_status_t
    563 _cairo_gstate_rotate (cairo_gstate_t *gstate, double angle)
    564 {
    565     cairo_matrix_t tmp;
    566 
    567     _cairo_gstate_unset_scaled_font (gstate);
    568     
    569     cairo_matrix_init_rotate (&tmp, angle);
>   570     cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
    571 
    572     cairo_matrix_init_rotate (&tmp, -angle);
    573     cairo_matrix_multiply (&gstate->ctm_inverse, &gstate->ctm_inverse,
&tmp);
    574 
    575     return CAIRO_STATUS_SUCCESS;
    576 }
(ladebug) print angle
1.5707963267948966
(ladebug) print tmp
struct _cairo_matrix {
  xx = 2.172393021099427e-311;
  yx = 2.6525782160381117e-314;
  xy = -2.6525782160381117e-314;
  yy = 2.172393021099427e-311;
  x0 = 0;
  y0 = 0;
}

These values trigger the SIGFPE in the cairo_matrix_multiply() routine.

If I #undef HAVE_SINCOS and rebuild, so that separate calls to sin() and cos()
are made, the values filled in by cairo_matrix_init_rotate are much more
sensible, and the transforms test passes.

If it's a big win performance-wise to call sincos() instead of separate calls to
sin() and cos(), I can try find a way to augment the autoconf test for sincos()
so that it detects a nonfunctional sincos().  If it's not a big win, it might be
better to just use sin() and cos() all the time.

Let me know what you think the best approach is.          
     
     
--           
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email         
     
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


More information about the cairo-bugs mailing list