digitalmars.D.bugs - [Issue 21424] New: Variable is incremented twice
- d-bugmail puremagic.com (28/28) Nov 24 2020 https://issues.dlang.org/show_bug.cgi?id=21424
https://issues.dlang.org/show_bug.cgi?id=21424 Issue ID: 21424 Summary: Variable is incremented twice Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: tim.dlang t-online.de The following code fails with dmd v2.094.1 under Linux x86_64: int main() { ubyte[10] buf; size_t pos = 0; size_t num = 5; buf[pos++] += num; assert(pos == 1); assert(buf[0] == 5); assert(buf[1] == 0); return 0; } Instead pos == 2, buf[0] == 0 and buf[1] == 5. The same code works as expected with ldc and gdc. --
Nov 24 2020