www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8525] New: optimizer loops infinitely

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

           Summary: optimizer loops infinitely
           Product: D
           Version: D2
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dawg dawgfoto.de



OpenBSD-only

cat > bug.d << CODE
class Foo
{
    int[] elements;

    final int bar()
    {
        return elements[0];
    }
}
CODE

dmd -c -O bug.d

----

The bug is caused by infinitely performing two associative transformations.

- cgelem.c(4444): Replace (a op1 (b op2 c)) with ((a op2 b) op1 c)
- cgelem.c(4471): Replace ((a op c1) op c2) with (a op (c2 op c1))

It only happens on OpenBSD because folding 'c2 op c1' fails in evalu8 due to a
fenv.h workaround.
The proposed fix is to perform the first transformation only if 'b' is not a
constant.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 08 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8525




There is another similar bug.
cat > bug.d << CODE
int get(int[] devt)
{
    return devt[$ - 1];
}
CODE

dmd -c -O bug.d

----

This can be reproduced on non-OpenBSD platforms by deactivating evalu8,
i.e. defining 'elem * evalu8(elem *e) { return e; }'. This is effectively
what this functions does on OpenBSD.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 08 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8525




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

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