From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5312 invoked by alias); 20 Feb 2015 22:14:44 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 5266 invoked by uid 48); 20 Feb 2015 22:14:39 -0000 From: "alexey.lapshin at oracle dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/65146] alignment of _Atomic structure member is not correct Date: Fri, 20 Feb 2015 22:51:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: alexey.lapshin at oracle dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg02342.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65146 --- Comment #2 from Alexey Lapshin --- if alignment of atomic object less then it`s size then it could not be lock-free on x86 32. If that object would split across cache lines then the operation would not be atomic. At the same time compiler reports for this 8-bytes size object: __atomic_always_lock_free(sizeof(obj2.ao), &obj2.ao) TRUE atomic_is_lock_free( &obj2.ao ) TRUE so it looks like lock-free atomic operation on this 4-bytes aligned data object could fail to be atomic.