[Issue 14114] New: DMD optimizer defeats use of volatileLoad/Store with error: null dereference in function

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Feb 2 10:43:19 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14114

          Issue ID: 14114
           Summary: DMD optimizer defeats use of volatileLoad/Store with
                    error: null dereference in function
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

>From the NG, the following example written by Walter as a way to demonstrate
volatileLoad/volatileStore actually does not work with -O

example.d(4): Error: null dereference in function _D7example5Ports1BFZh
---
import core.bitop;

 struct Ports {
    static ubyte B() { return volatileLoad(cast(ubyte *)0x0025); } // error
here
    static void B(ubyte value) { volatileStore(cast(ubyte *)0x0025, value); }
  }

void main() {
  Ports.B = 7;
  auto foo = Ports.B;
}

--


More information about the Digitalmars-d-bugs mailing list