www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6997] New: 64bit optimizer bug

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6997

           Summary: 64bit optimizer bug
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: timon.gehr gmx.ch



long fun(long a,long b,long c){
    return a<b?a<c?a:b<c?b:c:b;
}
long baz(long a, long b){
    bool s=(a<0)!=(b<0);
    a = a>0?a:-a;
    return s ? a : a;
}

struct R{
    ulong bar, qux;
    bool c;
    R foo(){
        if(!c){
            long a = baz(bar, 0),
                 b = baz(bar, 0),
                 c = baz(bar, 0);
            return R(fun(a,b,c), fun(a,b,c));
        }
        return R();
    }
}

void main(){auto x=R().foo();}

when compiled with dmd -O -release -inline (64bit), the program fails with a
segfault during runtime on my machine. Removing any of the flags makes it run
through.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 23 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6997


dawg dawgfoto.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dawg dawgfoto.de



https://github.com/D-Programming-Language/dmd/pull/528

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 23 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6997


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



13:58:08 PST ---
https://github.com/D-Programming-Language/dmd/commit/dc31bfc4bbc108e386dd0c38312dbf3fb740d9fa

https://github.com/D-Programming-Language/dmd/commit/3d84dede8f0da57aecdeea772eb3027c673a29e7

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