www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14114] New: DMD optimizer defeats use of volatileLoad/Store

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 puremagic.com
          Reporter: ibuclaw 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; } --
Feb 02 2015