[cairo-bugs] [Bug 103037] Segmentation fault in _cairo_traps_compositor_glyphs

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Oct 10 10:07:41 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=103037

--- Comment #20 from Adrian Johnson <ajohnson at redneon.com> ---
(In reply to Bill Spitzak from comment #15)
>   Thread 2:
>   // do not read x here
>   while (y != 1) { // non-atomic read!
>     // code that does other atomic operations
>   }
>   assert( x == foo ); // this works

That is relying on undefined behavior. Future versions of the compiler may
decided to optimize away second and subsequent reads. 

> Vast amounts of software assumes this works.

As we saw with the gcc integer overflow optimizations many years ago, the
compiler developers will be unsympathetic to this argument and point you to the
spec.

I had a look around for performance figures on atomic reads and came across
this:

https://htor.inf.ethz.ch/publications/img/atomic-bench.pdf

I don't think the cost of an atomic read is worth trying to optimize. In any
case, it is the job of the compiler to implement the read in the fastest way
possible.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo-bugs/attachments/20171010/faf41c4d/attachment.html>


More information about the cairo-bugs mailing list