Thread overview
[Issue 2151] New: Optimizer generates buggy array appending code
Jun 16, 2008
d-bugmail
[Issue 2151] -release generates buggy array appending code
Jun 17, 2008
d-bugmail
Jun 30, 2008
d-bugmail
Sep 20, 2009
Don
June 16, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2151

           Summary: Optimizer generates buggy array appending code
           Product: D
           Version: 2.014
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: aniketdhamal@yahoo.co.in
        ReportedBy: kolos80@bk.ru


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.


-- 

June 17, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2151





------- Comment #1 from kolos80@bk.ru  2008-06-17 07:34 -------
Sorry for mistake. It's -release option's blame, but it's still a bug :)


-- 

June 30, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2151





------- Comment #2 from clugdbug@yahoo.com.au  2008-06-30 08:02 -------
Create a complete example showing the problem. Otherwise this will never get fixed.


-- 

September 20, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2151


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug@yahoo.com.au
         Resolution|                            |INVALID


--- Comment #3 from Don <clugdbug@yahoo.com.au> 2009-09-20 12:32:16 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------