http://bugzilla.gdcproject.org/show_bug.cgi?id=84
Bug #: 84 Summary: Writes to struct members marked as shared are not volatile Classification: Unclassified Product: GDC Version: development Platform: All OS/Version: All Status: NEW Severity: normal Priority: Normal Component: gdc AssignedTo: ibuc...@gdcproject.org ReportedBy: johannesp...@gmail.com As originally reported by Timo Sintonen in the D.gnu newsgroup, see http://forum.dlang.org/thread/cbdjfujryokvvwvet...@forum.dlang.org#post-tzakpzaooenwrkpdbxgw:40forum.dlang.org Test case in D --------------------------------------------- struct Register { shared size_t a; } Register* reg = cast(Register*)0xFFDDCCAA; void main() { for(size_t i = 0; i < 10; i++) reg.a = i; } --------------------------------------------- Same test case in C (working): --------------------------------------------- #include <stdlib.h> struct Register { volatile size_t a; }; typedef struct Register reg_t; reg_t* reg = (reg_t*)0xFFDDCCAA; void main() { size_t i; for(i = 0; i < 10; i++) reg->a = i; } --------------------------------------------- Compile with gdc -O3 test.d -S gcc -O3 test.c -S Of course the code won't run but the wrong optimization is obvious in the generated ASM. I had a quick look at the fdump-tree-original-raw output but I didn't see a obvious difference between the C/D output. -- Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.