www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2151] New: Optimizer generates buggy array appending code

reply d-bugmail puremagic.com writes:
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.


-- 
Jun 16 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2151






Sorry for mistake. It's -release option's blame, but it's still a bug :)


-- 
Jun 17 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2151






Create a complete example showing the problem. Otherwise this will never get
fixed.


-- 
Jun 30 2008
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Sep 20 2009