From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24284 invoked by alias); 30 Dec 2012 17:07:33 -0000 Received: (qmail 24176 invoked by uid 48); 30 Dec 2012 17:07:05 -0000 From: "dvyukov at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/55561] TSAN: Fortran/OMP yields false positives Date: Sun, 30 Dec 2012 17:07:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dvyukov at google 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-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-12/txt/msg02437.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55561 --- Comment #26 from Dmitry Vyukov 2012-12-30 17:07:01 UTC --- (In reply to comment #25) > (In reply to comment #24) > > For testing you can comment out first 2 lines of gomp_ptrlock_get(). That > > should fix the race in libgomp. It's not a good fix form performance pov, but > > should be OK for testing. > > Thanks.. it turns out that gomp_ptrlock_get is actually used from > > gcc/libgomp/config/linux/ptrlock.h:74 > > on linux... is it still sufficient to comment the first if condition only and > keep the atomic_compare_exchange, or should one directly have the 'return > gomp_ptrlock_get_slow' ? Ah, I was looking at config/posix/ptrlock. For config/linux/ptrlock the changes are: if ((uintptr_t) *ptrlock > 2) return *ptrlock; \/\/\/\/\/\/\/\/\/\/\/\/ uintptr_t v = (uintptr_t)__atomic_load(ptrlock, MEMMODEL_ACQUIRE); if (v > 2) return v; return *ptrlock; \/\/\/\/\/\/\/\/\/\/\/\/ return __atomic_load(ptrlock, MEMMODEL_ACQUIRE); Also loads of intptr needs to be done with __atomic_load(MEMMODEL_RELAXED). and do_spin() needs to load *addr with __atomic_load(MEMMODEL_RELAXED) as well.