|
Archives
D Programming
digitalmars.Ddigitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger D.gnu D C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
D.gnu - [Issue 2584] New: GDC on ARM does not honor volatile
http://d.puremagic.com/issues/show_bug.cgi?id=2584 Summary: GDC on ARM does not honor volatile Product: DGCC aka GDC Version: unspecified Platform: Other OS/Version: Other Status: NEW Severity: major Priority: P2 Component: glue layer AssignedTo: dvdfrdmn users.sf.net ReportedBy: default_357-line yahoo.de In GDC on ARM, the following code struct Test { uint* ptr; uint write(uint i) { volatile (*ptr) = i; return i; } } void main() { Test test; test.ptr = cast(uint*) 0xDEAD_BEEF; test.write(0); test.write(0); test.write(0); return; } generates this assembly: http://paste.dprogramming.com/dpep5uc3 . Note how the 0 is only stored once, not thrice, in blatant violation of the volatile. -- Jan 13 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2584 ------- Comment #1 from default_357-line yahoo.de 2009-01-13 05:31 ------- Sorry. Please disregard for now. I'm seeing conflicting results. -- Jan 13 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2584 ------- Comment #2 from default_357-line yahoo.de 2009-01-13 05:44 ------- Right. Here we go. I had testcased it incorrectly. The code to reproduce the error is struct Test { uint* ptr; uint write(uint i) { volatile (*ptr) = i; return i; } static Test opCall() { // it has to be returned by a function call, otherwise the error doesn't happen Test res; res.ptr = cast(uint*) 0xDEAF_D00D; return res; } } void main() { auto mat = Test(); asm { " baz"; }; // added to make sure it's the correct assembly this time mat.write(0); mat.write(0); mat.write(0); return; } And the assembly is here http://paste.dprogramming.com/dpag1p5d -- Jan 13 2009
|