Bug 2151 – -release generates buggy array appending code

Status
RESOLVED
Resolution
INVALID
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-06-16T09:11:00Z
Last change time
2015-06-09T01:21:35Z
Keywords
wrong-code
Assigned to
nobody
Creator
kolos80

Comments

Comment #0 by kolos80 — 2008-06-16T09:11:21Z
I have a loop like this: i = 0; ... while (i < s.length && s[i] != '"') { ... tmp ~= s[i]; ++i; } Usually it works great. When I use the -O flag, it sometimes crashes, but if I write it like this: char c; ... tmp ~= c = s[i]; ... then it works great again. I don't see any reason for this strange behavior, except of optimizer's tricks.
Comment #1 by kolos80 — 2008-06-17T07:34:20Z
Sorry for mistake. It's -release option's blame, but it's still a bug :)
Comment #2 by clugdbug — 2008-06-30T08:02:41Z
Create a complete example showing the problem. Otherwise this will never get fixed.
Comment #3 by clugdbug — 2009-09-20T12:32:16Z
This is probably just incorrect code, with memory corruption, and it's just "luck" that it works without -release. Marking as invalid since there's no test case, and there's an probable explanation which doesn't involve a compiler bug.