[Issue 13793] New: @nogc std.algorithm.count(std.range.only)
https://issues.dlang.org/show_bug.cgi?id=13793 Issue ID: 13793 Summary: @nogc std.algorithm.count(std.range.only) Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Keywords: rejects-valid Severity: enhancement Priority: P1 Component: Phobos Assignee: nob...@puremagic.com Reporter: bearophile_h...@eml.cc I think this doesn't need to allocate heap memory: void main() @nogc { import std.algorithm: count; import std.range: only; int[] a; auto r = a.count(only(0, 1)); } dmd 2.067alpha: test.d(5,21): Error: @nogc function 'D main' cannot call non-@nogc function 'std.algorithm.count!(a == b, int[], OnlyResult!(int, 1u)).count' --
[Issue 13794] New: Vector operations with bigints too
https://issues.dlang.org/show_bug.cgi?id=13794 Issue ID: 13794 Summary: Vector operations with bigints too Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Keywords: rejects-valid Severity: enhancement Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: bearophile_h...@eml.cc I think this code should work (and be replaced by a loop by the front-end): void main() { import std.bigint; BigInt[2] a; a[] += a[]; } dmd 2.067alpha: test.d(4,9): Error: invalid array operation 'a[] += a[]' because BigInt doesn't support necessary arithmetic operations --
[Issue 13795] New: DMD ICE segfault compiling druntime
https://issues.dlang.org/show_bug.cgi?id=13795 Issue ID: 13795 Summary: DMD ICE segfault compiling druntime Product: D Version: D2 Hardware: x86_64 OS: Mac OS X Status: NEW Severity: major Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: john.loughran.col...@gmail.com Reduced from a segfault compiling runtime: void f() { T1!cfloat; } template T0(T) { void g(T v) { v = 0 + 0i; } } template T1(T) { void h() { if (T0!T) return; } } output when compiled: test3.d(18): Error: expression Floating!cfloat of type void does not have a boolean value test3.d(19): Error: return expression expected test3.d(3): Error: template instance test3.Array!cfloat error instantiating Segmentation fault: 11 Tested on OS X 10.10, dmd git HEAD --
[Issue 13796] New: A simple array head const struct for Phobos
https://issues.dlang.org/show_bug.cgi?id=13796 Issue ID: 13796 Summary: A simple array head const struct for Phobos Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: Phobos Assignee: nob...@puremagic.com Reporter: bearophile_h...@eml.cc In D code it's a good idea to set as const/immutable (where possible) all variables that don't need to change, for both safety and compiler-enforced code documentation. In my D functions sometimes I create dynamic arrays that later don't have to change length nor to be reassigned, but I have to mutate or assign their items. So their length and ptr can be const/immutable, unlike the array contents. The D type system doesn't allow this. So is it a good idea to try to add to Phobos a arrayHeadConst function similar to this (only for built-in dynamic arrays) that tries to enforce those constraints? import std.traits, std.range; struct ArrayHeadConst(T) { T[] data; alias data this; @property size_t length() const pure nothrow @safe @nogc { return data.length; } @disable void opAssign(); } ArrayHeadConst!(ElementType!R) arrayHeadConst(R)(R arr) if (isDynamicArray!R) { return typeof(return)(arr); } void main() { import std.stdio; auto arr = new int[2].arrayHeadConst; arr[1] = 10; arr[1].writeln; arr.length.writeln; //arr.length = arr.length + 1; // error auto b = new int[2]; //arr = b; // error arr[] = b[]; b = arr; arr[] = 1; ArrayHeadConst!int c = arr; ArrayHeadConst!int d; arr = d; // fail } --
[Issue 13795] DMD ICE segfault compiling druntime
https://issues.dlang.org/show_bug.cgi?id=13795 --- Comment #1 from John Colvin john.loughran.col...@gmail.com --- lldb output: Process 78905 stopped * thread #1: tid = 0x23835c, 0x00010002e2bd dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) frame #0: 0x00010002e2bd dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45 dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45: - 0x10002e2bd: movaps %xmm1, 0x40(%rdi) 0x10002e2c1: movaps %xmm0, 0x30(%rdi) 0x10002e2c5: movq %rcx, 0x20(%rdi) 0x10002e2c9: popq %rbp (lldb) bt all * thread #1: tid = 0x23835c, 0x00010002e2bd dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) * frame #0: 0x00010002e2bd dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45 frame #1: 0x000100015cbf dmd`Cast(Type*, Type*, Expression*) + 879 frame #2: 0x0001000a02a4 dmd`Expression_optimize(Expression*, int, bool)::OptimizeVisitor::visit(CastExp*) + 964 frame #3: 0x00010009f495 dmd`Expression_optimize(Expression*, int, bool)::OptimizeVisitor::visit(BinExp*) + 133 frame #4: 0x00010009ee2a dmd`Expression_optimize(Expression*, int, bool) + 42 frame #5: 0x0001000b845e dmd`ExpStatement::semantic(Scope*) + 94 frame #6: 0x0001000b8efc dmd`CompoundStatement::semantic(Scope*) + 284 frame #7: 0x0001000545d1 dmd`FuncDeclaration::semantic3(Scope*) + 3425 frame #8: 0x0001000d7f84 dmd`TemplateInstance::semantic3(Scope*) + 276 frame #9: 0x0001000d295f dmd`TemplateInstance::semantic(Scope*, ArrayExpression**) + 2463 frame #10: 0x00010003284a dmd`ScopeExp::semantic(Scope*) + 154 frame #11: 0x0001000b8423 dmd`ExpStatement::semantic(Scope*) + 35 frame #12: 0x0001000b8efc dmd`CompoundStatement::semantic(Scope*) + 284 frame #13: 0x0001000545d1 dmd`FuncDeclaration::semantic3(Scope*) + 3425 frame #14: 0x00010007c984 dmd`Module::semantic3() + 84 frame #15: 0x000100079f60 dmd`tryMain(unsigned long, char const**) + 10576 frame #16: 0x00010e18 dmd`_start + 230 frame #17: 0x00010d31 dmd`start + 33 (lldb) disas dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*): 0x10002e290: pushq %rbp 0x10002e291: movq %rsp, %rbp 0x10002e294: movq %rsi, 0x8(%rdi) 0x10002e298: movq %rdx, 0x10(%rdi) 0x10002e29c: movl $0x98, 0x18(%rdi) 0x10002e2a3: movb $0x50, 0x28(%rdi) 0x10002e2a7: movb $0x0, 0x29(%rdi) 0x10002e2ab: leaq 0x1f4bee(%rip), %rax ; vtable for ComplexExp + 16 0x10002e2b2: movq %rax, (%rdi) 0x10002e2b5: movaps 0x10(%rbp), %xmm0 0x10002e2b9: movaps 0x20(%rbp), %xmm1 - 0x10002e2bd: movaps %xmm1, 0x40(%rdi) 0x10002e2c1: movaps %xmm0, 0x30(%rdi) 0x10002e2c5: movq %rcx, 0x20(%rdi) 0x10002e2c9: popq %rbp 0x10002e2ca: retq 0x10002e2cb: nopl (%rax,%rax) (lldb) register read General Purpose Registers: rax = 0x000100222ea0 dmd`vtable for ComplexExp + 16 rbx = 0x7fff5fbff388 rcx = 0x0001005018d0 rdx = 0x000d000a rdi = 0x7fff5fbff388 rsi = 0x000100405220 rbp = 0x7fff5fbff180 rsp = 0x7fff5fbff180 r8 = 0x r9 = 0x0004 r10 = 0x00010060 r11 = 0x0001 r12 = 0x0001005018d0 r13 = 0x0001005018d0 r14 = 0x0001005018d0 r15 = 0x000100616100 rip = 0x00010002e2bd dmd`ComplexExp::ComplexExp(Loc, complex_t, Type*) + 45 rflags = 0x00010206 cs = 0x002b fs = 0x gs = 0x --
[Issue 13797] New: std.array.extend
https://issues.dlang.org/show_bug.cgi?id=13797 Issue ID: 13797 Summary: std.array.extend Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: Phobos Assignee: nob...@puremagic.com Reporter: bearophile_h...@eml.cc I suggest to add to Phobos a simple function like this, mainly useful to extend dynamic arrays with a given lazy iterable (but this works with std.array.array too): void extend(A, R)(ref A arr, R iterable) if (__traits(compiles, { foreach (item; iterable) arr ~= item; })) { import std.range: hasLength; static if (hasLength!R hasLength!A) arr.reserve(arr.length + iterable.length); foreach (item; iterable) arr ~= item; } void main() { import std.stdio, std.range; int[] arr; arr.extend(only(1, 2, 3, 4)); writeln(arr); static struct Gen5 { int opApply(int delegate(ref int) dg) { int result; foreach (i; 0 .. 5) { result = dg(i); if (result) break; } return result; } } arr.extend(Gen5()); writeln(arr); import std.container: Array; Array!int arr2; writeln(arr2[]); arr2.extend(only(1, 2, 3, 4)); writeln(arr2[]); } --
[Issue 13759] VS2010 Win64 linker path wrong
https://issues.dlang.org/show_bug.cgi?id=13759 --- Comment #6 from Rainer Schuetze r.sagita...@gmx.de --- I couldn't install VS2010, but it seems the problem also exist on VS2012: - the 32-bit link.exe is in $(VSINSTALLDIR)\VC\bin - the 32-bit mspdb110.dll is in $(VSINSTALLDIR)\Common7\IDE - the 64-bit link.exe is in $(VSINSTALLDIR)\VC\bin\amd64 - the 64-bit mspdb110.dll also is in $(VSINSTALLDIR)\VC\bin\amd64 As long as the DLL is in the same folder as the linker executable, it should be fine. In VS2013, $(VSINSTALLDIR)\VC\bin also contains mspdb120.dll, so you don't run into any issues. So, to make both 32bit and 64-bit linker work, adding $(VSINSTALLDIR)\Common7\IDE to the executable paths should do the trick. --
[Issue 13726] Build Phobos and Druntime with stack frames enabled (-gs)
https://issues.dlang.org/show_bug.cgi?id=13726 --- Comment #11 from Martin Nowak c...@dawg.eu --- (In reply to Vladimir Panteleev from comment #9) I don't understand... I'm not sure what the scheme is on POSIX, but on Win32, exception frames and stack frames are completely separate (they form two distinct linked lists which do not overlap). https://gnu.wildebeest.org/blog/mjw/2007/08/23/stack-unwinding/ --
[Issue 13726] Build Phobos and Druntime with stack frames enabled (-gs)
https://issues.dlang.org/show_bug.cgi?id=13726 --- Comment #12 from Martin Nowak c...@dawg.eu --- (In reply to Vladimir Panteleev from comment #6) Martin, do you have a benchmark for which the performance difference is non-negligible? It would affect any leaf function that is not inlined. For example this would kill what Manu had in mind for std.simd, a module where each function consists of a few SIMD instrustions. I've been building D from source code on my server for a while now, just to enable stack frames. They are invaluable for debugging, I use them for production all the time. I am confident that at the moment, D will benefit more from stack frames in Phobos/Druntime than 0.1% in performance. It's 0.1% performance loss for you but maybe 1 or 2% for someone else. There is so much we can do to improve stack traces, but enforcing stack frames is a performance trade-off. --
[Issue 13696] Missing entry for unicode code point literals on the lexer page
https://issues.dlang.org/show_bug.cgi?id=13696 --- Comment #2 from github-bugzi...@puremagic.com --- Commit pushed to master at https://github.com/D-Programming-Language/dlang.org https://github.com/D-Programming-Language/dlang.org/commit/b8feb9dc12b050bc23efa78df0d2658bc74b0932 Merge pull request #710 from quickfur/issue13696 Issue 13696: Document meaning of escape sequences. --
[Issue 13696] Missing entry for unicode code point literals on the lexer page
https://issues.dlang.org/show_bug.cgi?id=13696 hst...@quickfur.ath.cx changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 13759] VS2010 Win64 linker path wrong
https://issues.dlang.org/show_bug.cgi?id=13759 --- Comment #7 from Rainer Schuetze r.sagita...@gmx.de --- Next time you have to install Visual D, please try https://github.com/D-Programming-Language/visuald/releases/tag/v0.3.40-beta3 --
[Issue 13795] DMD ICE segfault compiling druntime
https://issues.dlang.org/show_bug.cgi?id=13795 --- Comment #2 from Kenji Hara k.hara...@gmail.com --- At least the segfault doesn't occur in Windows, with git HEAD (4c98263) --
[Issue 13563] ICE with opIndexAssign op-overloading and ModuleScopeOperator
https://issues.dlang.org/show_bug.cgi?id=13563 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added CC||sfrijt...@gmail.com --- Comment #3 from Kenji Hara k.hara...@gmail.com --- *** Issue 13789 has been marked as a duplicate of this issue. *** --
[Issue 13789] [ICE v2.067-devel-639bcaa] statement.c:754: Assertion `global.gaggedErrors || global.errors' failed.
https://issues.dlang.org/show_bug.cgi?id=13789 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #1 from Kenji Hara k.hara...@gmail.com --- The root issue is a dup of issue 13563, so the bug is already fixed on git-head (4c98263313). *** This issue has been marked as a duplicate of issue 13563 *** --
[Issue 13787] Error without line number when slicing function pointer
https://issues.dlang.org/show_bug.cgi?id=13787 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 13787] Error without line number when slicing function pointer
https://issues.dlang.org/show_bug.cgi?id=13787 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/dfa0b4b4523581cea7738c4cb169416e65caefd4 fix Issue 13787 - Error without line number when slicing function pointer https://github.com/D-Programming-Language/dmd/commit/ed9a18a5f0c48262173aa59f4e065fe7195fe443 Merge pull request #4181 from 9rnsr/fix13787 Issue 13787 - Error without line number when slicing function pointer --
[Issue 13788] dmd segfault, pragma(mangle) and a mixin
https://issues.dlang.org/show_bug.cgi?id=13788 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 13788] dmd segfault, pragma(mangle) and a mixin
https://issues.dlang.org/show_bug.cgi?id=13788 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6f3ea9d8809e9ded56499844165d56f7ff9f69a8 fix Issue 13788 - dmd segfault, pragma(mangle) and a mixin https://github.com/D-Programming-Language/dmd/commit/a58fa7c1ea163369ace37a83b39b487ede46876f Merge pull request #4180 from 9rnsr/fix13788 Issue 13788 - dmd segfault, pragma(mangle) and a mixin --
[Issue 13200] Assertion `protName' failed
https://issues.dlang.org/show_bug.cgi?id=13200 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --
[Issue 13200] Assertion `protName' failed
https://issues.dlang.org/show_bug.cgi?id=13200 --- Comment #5 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ea5d59e23025a994237c12903c5baae1f0c51c10 fix Issue 13200 - Assertion `protName' failed Set `parent`, `protection`, `isdeprecated`, and `userAttribDecl` members of `EnumDeclaration` as same as class and struct declarations, even if its definition is opaque. https://github.com/D-Programming-Language/dmd/commit/ab5dbd53a4f217ef0e20149867211a82d50efc46 Merge pull request #4179 from 9rnsr/fix13200 Issue 13200 - Assertion `protName' failed --