public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gccbugzilla at limegreensocks dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/62109] __gthr_i486_lock_cmp_xchg missing clobber Date: Tue, 17 Mar 2015 23:10:00 -0000 [thread overview] Message-ID: <bug-62109-4-Cr2onZo9YB@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-62109-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62109 --- Comment #6 from David <gccbugzilla at limegreensocks dot com> --- Actually, the code already uses InterlockedCompareExchange. UNLESS users explicitly tell it not to: #ifdef __GTHREAD_I486_INLINE_LOCK_PRIMITIVES static inline long __gthr_i486_lock_cmp_xchg(long *__dest, long __xchg, long __comperand) { long result; __asm__ __volatile__ ("\n\ lock\n\ cmpxchg{l} {%4, %1|%1, %4}\n" : "=a" (result), "=m" (*__dest) : "0" (__comperand), "m" (*__dest), "r" (__xchg) : "cc"); return result; } #define __GTHR_W32_InterlockedCompareExchange __gthr_i486_lock_cmp_xchg #else /* __GTHREAD_I486_INLINE_LOCK_PRIMITIVES */ #define __GTHR_W32_InterlockedCompareExchange InterlockedCompareExchange #endif /* __GTHREAD_I486_INLINE_LOCK_PRIMITIVES */ Since we are talking about postponing this to stage 1 (which I do not object to), what if we change this to something like: #ifdef __GTHREAD_I486_INLINE_LOCK_PRIMITIVES #error "__GTHREAD_I486_INLINE_LOCK_PRIMITIVES is no longer supported. Remove this definition to use system calls for Win98 and above." #else /* __GTHREAD_I486_INLINE_LOCK_PRIMITIVES */ #define __GTHR_W32_InterlockedCompareExchange InterlockedCompareExchange #endif /* __GTHREAD_I486_INLINE_LOCK_PRIMITIVES */ Then wait to see if anyone cares. I am ok with either fixing it (by adding the "memory" clobber) or removing it (since the problem it was intended to fix only happens on OSs that aren't supported anymore). But leaving it "as-is" leaves open the possibility that people are using this without even knowing it (and getting nearly-impossible-to-track-down timing problems). Or that someone might copy/paste this code into their own projects.
next prev parent reply other threads:[~2015-03-17 23:10 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-08-12 18:07 [Bug target/62109] New: " gccbugzilla at limegreensocks dot com 2015-02-17 6:52 ` [Bug target/62109] " pinskia at gcc dot gnu.org 2015-02-23 7:25 ` gccbugzilla at limegreensocks dot com 2015-02-23 11:23 ` mikpelinux at gmail dot com 2015-03-16 3:53 ` gccbugzilla at limegreensocks dot com 2015-03-17 13:44 ` ktietz at gcc dot gnu.org 2015-03-17 23:10 ` gccbugzilla at limegreensocks dot com [this message] 2015-03-19 10:47 ` ktietz at gcc dot gnu.org 2015-03-19 23:40 ` gccbugzilla at limegreensocks dot com 2015-03-20 12:06 ` ktietz at gcc dot gnu.org 2015-10-23 1:29 ` gccbugzilla at limegreensocks dot com 2015-10-23 10:00 ` ktietz at gcc dot gnu.org 2015-10-25 1:42 ` gccbugzilla at limegreensocks dot com 2022-01-15 13:33 ` [Bug libgcc/62109] " jyong at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-62109-4-Cr2onZo9YB@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).