http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54004
Bug #: 54004 Summary: __atomic_always_lock_free has a fault implementation in which the target has no saying Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: h...@gcc.gnu.org Depends on: 54003 Created attachment 27819 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27819 Conceptual patch - note comments Basically, fold_builtin_atomic_always_lock_free compares alignment of the type of the atomic data to that of the normal alignment for a mode. A better default is to compare to the *natural* alignment. For most targets, the two are the same. If that's approach is not ok, then a target hook is needed. Conceptual patch (i.e. untested, uncompiled) for the first approach attached. Note that this suggestion is counter to the documented dogma of "presence of library or atomic pattern implies lock-free-ness", but that already has inconsistencies, see linked PR. Note that this likely means we need a libgcc implementation for __atomic_is_lock_free or at least document that the target needs to supply one.