digitalmars.D.bugs - [Issue 11483] New: dmd inserts a gc allocation where none is required
- d-bugmail puremagic.com (75/75) Nov 09 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11483
- d-bugmail puremagic.com (11/11) Nov 09 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11483
https://d.puremagic.com/issues/show_bug.cgi?id=11483 Summary: dmd inserts a gc allocation where none is required Product: D Version: D2 Platform: All OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: ellery-newcomer utulsa.edu 06:24:22 PST --- the code: a.d: class C { void _InsertAllBut(int v) { int* node = null; enum mutable = __traits(compiles, {node.value ;}); } } test.d: import a; void main () { C c = new C(); c._InsertAllBut(1); } the compilation: dmd test.d a.d with dmd 2.063, appears on linux 32 and 64 bit the disassembly: ... 00000000004178b0 <void a.C._InsertAllBut(int)>: 4178b0: 55 push rbp 4178b1: 48 8b ec mov rbp,rsp 4178b4: 48 83 ec 38 sub rsp,0x38 4178b8: 53 push rbx 4178b9: 48 89 7d f0 mov QWORD PTR [rbp-0x10],rdi 4178bd: 48 bf 10 00 00 00 00 movabs rdi,0x10 4178c4: 00 00 00 4178c7: e8 e8 21 00 00 call 419ab4 <_d_allocmemory> 4178cc: 48 89 45 e0 mov QWORD PTR [rbp-0x20],rax 4178d0: 48 8b 4d f0 mov rcx,QWORD PTR [rbp-0x10] 4178d4: 48 89 08 mov QWORD PTR [rax],rcx 4178d7: 48 85 c9 test rcx,rcx 4178da: 75 35 jne 417911 <void a.C._InsertAllBut(int)+0x61> 4178dc: 41 b8 03 00 00 00 mov r8d,0x3 4178e2: 48 8b 0d 8f 8d 01 00 mov rcx,QWORD PTR [rip+0x18d8f] 4178e9: 48 8b 05 80 8d 01 00 mov rax,QWORD PTR [rip+0x18d80] 4178f0: 48 89 c2 mov rdx,rax 4178f3: 48 89 55 d8 mov QWORD PTR [rbp-0x28],rdx 4178f7: 48 8b 15 9a 8d 01 00 mov rdx,QWORD PTR [rip+0x18d9a] 4178fe: 48 8b 3d 8b 8d 01 00 mov rdi,QWORD PTR [rip+0x18d8b] 417905: 48 89 d6 mov rsi,rdx 417908: 48 8b 55 d8 mov rdx,QWORD PTR [rbp-0x28] 41790c: e8 5b 19 00 00 call 41926c <_d_assert_msg> 417911: 48 89 cf mov rdi,rcx 417914: e8 6b 21 00 00 call 419a84 <void invariant._d_invariant(Object)> 417919: 48 8b 5d e0 mov rbx,QWORD PTR [rbp-0x20] 41791d: 48 c7 43 08 00 00 00 mov QWORD PTR [rbx+0x8],0x0 417924: 00 417925: 5b pop rbx 417926: c9 leave 417927: c3 ret ... -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 09 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11483 06:37:55 PST --- looks like for workaround you can change __traits(compiles, {node.value ;}); to __traits(compiles, node.value); or put it in a template. Doesn't seem to be triggered by std.range.isInputRange and friends. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 09 2013