[Issue 3700] New: Ref foreach over large static arrays fails
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 13 00:21:32 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3700
Summary: Ref foreach over large static arrays fails
Product: D
Version: 2.038
Platform: Other
OS/Version: Linux
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bugzilla at kyllingen.net
--- Comment #0 from Lars T. Kyllingstad <bugzilla at kyllingen.net> 2010-01-13 00:21:30 PST ---
This code correctly compiles, but causes a segmentation fault when run:
void main()
{
double[1_000_000] a;
foreach (ref e; a) e = 1.0;
}
In case it helps, here's a disassembly of the main function. A run through the
debugger shows that the offending instruction is located at 0x080490cd.
080490c4 <_Dmain>:
80490c4: 55 push %ebp
80490c5: 8b ec mov %esp,%ebp
80490c7: 81 ec 1c 24 f4 00 sub $0xf4241c,%esp
80490cd: 53 push %ebx
80490ce: 57 push %edi
80490cf: b9 80 84 1e 00 mov $0x1e8480,%ecx
80490d4: 31 c0 xor %eax,%eax
80490d6: 8d bd e4 db 0b ff lea -0xf4241c(%ebp),%edi
80490dc: f3 ab rep stos %eax,%es:(%edi)
80490de: 8d 8d e4 db 0b ff lea -0xf4241c(%ebp),%ecx
80490e4: bb 40 42 0f 00 mov $0xf4240,%ebx
80490e9: 89 9d e4 ed 85 ff mov %ebx,-0x7a121c(%ebp)
80490ef: 89 8d e8 ed 85 ff mov %ecx,-0x7a1218(%ebp)
80490f5: 89 85 ec ed 85 ff mov %eax,-0x7a1214(%ebp)
80490fb: 8b 95 ec ed 85 ff mov -0x7a1214(%ebp),%edx
8049101: 3b 95 e4 ed 85 ff cmp -0x7a121c(%ebp),%edx
8049107: 73 42 jae 804914b <_Dmain+0x87>
8049109: 8b 85 ec ed 85 ff mov -0x7a1214(%ebp),%eax
804910f: 3b 85 e4 ed 85 ff cmp -0x7a121c(%ebp),%eax
8049115: 72 0a jb 8049121 <_Dmain+0x5d>
8049117: b8 04 00 00 00 mov $0x4,%eax
804911c: e8 33 00 00 00 call 8049154 <_D1d7__arrayZ>
8049121: 8b 8d ec ed 85 ff mov -0x7a1214(%ebp),%ecx
8049127: 8b 95 e8 ed 85 ff mov -0x7a1218(%ebp),%edx
804912d: 8b 85 e4 ed 85 ff mov -0x7a121c(%ebp),%eax
8049133: 8d 1c ca lea (%edx,%ecx,8),%ebx
8049136: c7 03 00 00 00 00 movl $0x0,(%ebx)
804913c: c7 43 04 00 00 f0 3f movl $0x3ff00000,0x4(%ebx)
8049143: ff 85 ec ed 85 ff incl -0x7a1214(%ebp)
8049149: eb b0 jmp 80490fb <_Dmain+0x37>
804914b: 31 c0 xor %eax,%eax
804914d: 5f pop %edi
804914e: 5b pop %ebx
804914f: c9 leave
8049150: c3 ret
8049151: 90 nop
8049152: 90 nop
8049153: 90 nop
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list