[cairo-bugs] [Bug 103559] New: Incorrect code generation for atomic operations if HAVE_INTEL_ATOMIC_PRIMITIVES defined

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Nov 3 12:27:33 UTC 2017


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

            Bug ID: 103559
           Summary: Incorrect code generation for atomic operations if
                    HAVE_INTEL_ATOMIC_PRIMITIVES defined
           Product: cairo
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: general
          Assignee: chris at chris-wilson.co.uk
          Reporter: fludkov.me at gmail.com
        QA Contact: cairo-bugs at cairographics.org

It is a follow up after https://bugs.freedesktop.org/show_bug.cgi?id=103037.
The patch has the loop:
    while (_cairo_atomic_int_get(once) != CAIRO_ATOMIC_ONCE_INITIALIZED) {}

When the library is compiled with HAVE_INTEL_ATOMIC_PRIMITIVES:
    /* whether memory barriers are needed around atomic operations */
    /* #undef ATOMIC_OP_NEEDS_MEMORY_BARRIER */
    ...
    #define HAVE_INTEL_ATOMIC_PRIMITIVES 1

The _cairo_atomic_int_get will be defined as:
   # define _cairo_atomic_int_get(x) (*x)

Which will make this loop to hot-loop forever, because gcc will optimize it and
read once instead of reading on every loop iteration.

Does anybody actually use the implementation under HAVE_INTEL_ATOMIC_PRIMITIVES
define? According to git history, the code under HAVE_CXX11_ATOMIC_PRIMITIVES
define landed after the one HAVE_INTEL_ATOMIC_PRIMITIVES. But should not it
have completely replaced it?

-- 
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/20171103/c320d096/attachment.html>


More information about the cairo-bugs mailing list