[Issue 16651] atomicOp!"-="(ulong, uint) = wrong result/codegen
https://issues.dlang.org/show_bug.cgi?id=16651 --- Comment #7 from github-bugzi...@puremagic.com --- Commits pushed to newCTFE at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/44f45280b7fe308731611801385f8c6226214682 fix issue 16651 - atomicOp!"-="(ulong, uint) = wrong result/codegen https://github.com/dlang/druntime/commit/422c8f7b0f0e6598910737981074e0c45a4eb1b9 Merge pull request #1690 from aG0aep6G/16651 --
[Issue 16651] atomicOp!"-="(ulong, uint) = wrong result/codegen
https://issues.dlang.org/show_bug.cgi?id=16651 --- Comment #6 from github-bugzi...@puremagic.com --- Commits pushed to scope at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/44f45280b7fe308731611801385f8c6226214682 fix issue 16651 - atomicOp!"-="(ulong, uint) = wrong result/codegen https://github.com/dlang/druntime/commit/422c8f7b0f0e6598910737981074e0c45a4eb1b9 Merge pull request #1690 from aG0aep6G/16651 --
[Issue 16651] atomicOp!"-="(ulong, uint) = wrong result/codegen
https://issues.dlang.org/show_bug.cgi?id=16651 --- Comment #5 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/44f45280b7fe308731611801385f8c6226214682 fix issue 16651 - atomicOp!"-="(ulong, uint) = wrong result/codegen https://github.com/dlang/druntime/commit/422c8f7b0f0e6598910737981074e0c45a4eb1b9 Merge pull request #1690 from aG0aep6G/16651 --
[Issue 16651] atomicOp!"-="(ulong, uint) = wrong result/codegen
https://issues.dlang.org/show_bug.cgi?id=16651 --- Comment #4 from github-bugzi...@puremagic.com --- Commits pushed to stable at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/44f45280b7fe308731611801385f8c6226214682 fix issue 16651 - atomicOp!"-="(ulong, uint) = wrong result/codegen https://github.com/dlang/druntime/commit/422c8f7b0f0e6598910737981074e0c45a4eb1b9 Merge pull request #1690 from aG0aep6G/16651 fix issue 16651 - atomicOp!"-="(ulong, uint) = wrong result/codegen --
[Issue 16651] atomicOp!"-="(ulong, uint) = wrong result/codegen
https://issues.dlang.org/show_bug.cgi?id=16651 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 16651] atomicOp!"-="(ulong, uint) = wrong result/codegen
https://issues.dlang.org/show_bug.cgi?id=16651 ag0ae...@gmail.com changed: What|Removed |Added Keywords||pull Assignee|nob...@puremagic.com|ag0ae...@gmail.com --- Comment #3 from ag0ae...@gmail.com --- https://github.com/dlang/druntime/pull/1690 --
[Issue 16651] atomicOp!"-="(ulong, uint) = wrong result/codegen
https://issues.dlang.org/show_bug.cgi?id=16651 safety0ff.bugzchanged: What|Removed |Added CC||safety0ff.b...@gmail.com --- Comment #2 from safety0ff.bugz --- (In reply to ag0aep6g from comment #1) > > Looks like a bug in druntime code (core.atomic) rather than dmd. Yup, atomicFetchSub [1] doesn't widen the modifier before negating it. This is necessary when the modifier is unsigned and narrower than the value's type. [1] https://github.com/dlang/druntime/blob/master/src/core/atomic.d#L684 --
[Issue 16651] atomicOp!"-="(ulong, uint) = wrong result/codegen
https://issues.dlang.org/show_bug.cgi?id=16651 ag0ae...@gmail.com changed: What|Removed |Added CC||ag0ae...@gmail.com Component|dmd |druntime Hardware|x86_64 |All OS|Windows |All --- Comment #1 from ag0ae...@gmail.com --- Same happens with -m32 and smaller types: void main() { import std.stdio: writeln; import core.atomic : atomicOp; shared uint foo = 2; ubyte bar = 1; atomicOp!"-="( foo, bar ); writeln( "foo = ", foo );// foo = 257 } Also happens on Linux. Looks like a bug in druntime code (core.atomic) rather than dmd. I think it works with LDC because they've added a path of their own to druntime [1]. [1] https://github.com/ldc-developers/druntime/blob/049b8efdf0daebcc1cfe690c5cf7585125c1ff72/src/core/atomic.d#L177 --