[Issue 15206] [REG2.077] ICE on optimized build, tym = x1d Internal error: backend\cgxmm.c 547

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15206

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com
Summary|ICE on optimized build, tym |[REG2.077] ICE on optimized
   |= x1d Internal error:   |build, tym = x1d Internal
   |backend\cgxmm.c 547 |error: backend\cgxmm.c 547
   Severity|critical|regression

--- Comment #8 from Seb  ---
Yep, can reproduce the test case from John too  e.g.
https://run.dlang.io/is/REkj3X

BTW digger says that this PR https://github.com/dlang/dmd/pull/7175 introduced
this. 
so I'm re-labelling this as a regression.

And also I can confirm that https://github.com/dlang/dmd/pull/8034 fixes this.

--


[Issue 18718] ICE in dmd/traits.d:417

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18718

--- Comment #1 from Seb  ---
A start - https://github.com/dlang/dmd/pull/8125 (<- needs more work)

--


[Issue 18723] New: std.exception.ErrnoException@std/stdio.d(1012): Enforcement failed (Bad file descriptor) when running the simplified benchmark

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18723

  Issue ID: 18723
   Summary: std.exception.ErrnoException@std/stdio.d(1012):
Enforcement failed (Bad file descriptor) when running
the simplified benchmark
   Product: D
   Version: D2
  Hardware: All
OS: FreeBSD
Status: NEW
  Severity: major
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: greensunn...@gmail.com

Comes from running the simplified benchmark.
Maybe this is related to / fixed by:

https://github.com/dlang/phobos/pull/6382


--
std.exception.ErrnoException@std/stdio.d(1012): Enforcement failed (Bad file
descriptor)
gmake -C test/typeinfo MODEL=64 OS=freebsd
DMD=/usr/home/braddr/sandbox/at-client/pull-3102365-FreeBSD_64_64/dmd/generated/freebsd/release/64/dmd
BUILD=debug \
   
DRUNTIME=/usr/home/braddr/sandbox/at-client/pull-3102365-FreeBSD_64_64/druntime/generated/freebsd/debug/64/libdruntime.a
DRUNTIMESO=/usr/home/braddr/sandbox/at-client/pull-3102365-FreeBSD_64_64/druntime/generated/freebsd/debug/64/libdruntime.so
LINKDL= \
QUIET= TIMELIMIT='timelimit -t 10 ' PIC=-fPIC

??:? @safe void
std.exception.bailOut!(std.exception.ErrnoException).bailOut(immutable(char)[],
ulong, const(char[])) [0x457555]
??:? @safe bool
std.exception.enforce!(std.exception.ErrnoException).enforce!(bool).enforce(bool,
lazy const(char)[], immutable(char)[], ulong) [0xcd6625]
??:? @safe ubyte[] std.stdio.File.rawRead!(ubyte).rawRead(ubyte[]) [0xd28dd3]
??:? void std.stdio.File.ByChunkImpl.prime() [0xd26875]
??:? ref std.stdio.File.ByChunkImpl
std.stdio.File.ByChunkImpl.__ctor(std.stdio.File, ubyte[]) [0xd269ca]
??:? ref std.stdio.File.ByChunkImpl
std.stdio.File.ByChunkImpl.__ctor(std.stdio.File, ulong) [0xd268f5]
??:? std.stdio.File.ByChunkImpl std.stdio.File.byChunk(ulong) [0xd26d1b]
??:? std.typecons.Tuple!(int, "status", immutable(char)[], "output").Tuple
std.process.executeImpl!(std.process.pipeShell(const(char[]),
std.process.Redirect, const(immutable(char)[][immutable(char)[]]),
std.process.Config, const(char[]), immutable(char)[]), const(char)[],
immutable(char)[]).executeImpl(const(char)[],
const(immutable(char)[][immutable(char)[]]), std.process.Config, ulong,
const(char[]), immutable(char)[]) [0xd1ea69]
??:? @trusted std.typecons.Tuple!(int, "status", immutable(char)[],
"output").Tuple std.process.executeShell(const(char[]),
const(immutable(char)[][immutable(char)[]]), std.process.Config, ulong,
const(char[]), immutable(char)[]) [0xd1b00a]
??:? std.regex.internal.ir.MatcherFactory!(char).MatcherFactory
std.regex.internal.ir.defaultFactory!(char).defaultFactory(ref
const(std.regex.internal.ir.Regex!(char).Regex)).thompsonFactory [0x4555a5]
??:? int runbench.runTests(runbench.Config).__foreachbody4(ref
immutable(char)[]) [0x45656c]
??:? void
std.parallelism.ParallelForeach!(immutable(char)[][]).ParallelForeach.opApply(scope
int delegate(ref immutable(char)[])).doIt() [0x489403]
??:? void std.parallelism.run!(void delegate()).run(void delegate()) [0xd159af]
??:? void std.parallelism.Task!(std.parallelism.run, void
delegate()).Task.impl(void*) [0xd154eb]
??:? void std.parallelism.AbstractTask.job() [0xd13e66]
??:? void std.parallelism.TaskPool.doJob(std.parallelism.AbstractTask*)
[0xd1403f]
??:? void std.parallelism.TaskPool.executeWorkLoop() [0xd14199]
??:? void std.parallelism.TaskPool.startWorkLoop() [0xd14140]
??:? void core.thread.Thread.run() [0xe134c3]
??:? thread_entryPoint [0xe1264c]
??:? pthread_create [0x11f1bc4]
??:? ??? [0x]
---

--


[Issue 18722] New: runnable/test13666.sh has magic failures on Windows

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18722

  Issue ID: 18722
   Summary: runnable/test13666.sh has magic failures on Windows
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: greensunn...@gmail.com

---
Test runnable/test13666.sh failed. The logged output:
test_results\runnable\test13666.lib: Error: MS-Coff object module
`lib13666.obj` has magic = 5ac3, should be 8664
test_results\runnable\test13666.lib: Error: MS-Coff object module
`lib13666_1_144.obj` has magic = 5ac3, should be 8664
test_results\runnable\test13666.lib: Error: MS-Coff object module
`lib13666_2_520.obj` has magic = 5ac3, should be 8664
==
Test runnable/test13666.sh failed. The xtrace output:
+ source runnable/test13666.sh
++ libname=test_results/runnable/test13666.lib
++ ../generated/windows/release/32/dmd.exe -m64 -Irunnable/extra-files
-oftest_results/runnable/test13666.lib -lib 'runnable/extra-files\lib13666.d'
---

--


[Issue 18721] New: ICE in dmd/cond.d(378) when compiling static foreach with -D

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18721

  Issue ID: 18721
   Summary: ICE in dmd/cond.d(378) when compiling static foreach
with -D
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: ice, ice-on-valid-code
  Severity: critical
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: greensunn...@gmail.com

>From https://github.com/dlang/phobos/pull/6402

Reduced:

> dmd -D

---
///
template allSameType()
{
static foreach (idx; T)
enum allSameType ;
}

---


---
core.exception.AssertError@dmd/cond.d(378): Assertion failure

??:? _d_assertp [0x74903d]
dmd/cond.d:378 pure nothrow @nogc @safe void
dmd.cond.StaticForeach.prepare(dmd.dscope.Scope*).__require() [0x51392f]
dmd/cond.d:377 void dmd.cond.StaticForeach.prepare(dmd.dscope.Scope*)
[0x5137dc]
dmd/attrib.d:1083 _ZN24StaticForeachDeclaration7includeEP5Scope [0x50c2df]
dmd/doc.d:1042 _ZN11emitComment11EmitComment5visitEP17AttribDeclaration
[0x55811b]
dmd/parsetimevisitor.d:75
_ZN16ParseTimeVisitorI10ASTCodegenE5visitEP24StaticForeachDeclaration
[0x6437f2]
dmd/attrib.d:1143 _ZN24StaticForeachDeclaration6acceptEP7Visitor [0x50c48d]
dmd/doc.d:1091 void dmd.doc.emitComment(dmd.dsymbol.Dsymbol,
dmd.root.outbuffer.OutBuffer*, dmd.dscope.Scope*) [0x557798]
dmd/doc.d:796 void dmd.doc.emitMemberComments(dmd.dsymbol.ScopeDsymbol,
dmd.root.outbuffer.OutBuffer*, dmd.dscope.Scope*) [0x55767c]
dmd/doc.d:916 _ZN11emitComment11EmitComment4emitEP5ScopeP7DsymbolPKc [0x557c57]
dmd/doc.d:960 _ZN11emitComment11EmitComment5visitEP11Declaration [0x557ded]
dmd/parsetimevisitor.d:47
_ZN16ParseTimeVisitorI10ASTCodegenE5visitEP16AliasDeclaration [0x643492]
dmd/declaration.d:929 _ZN16AliasDeclaration6acceptEP7Visitor [0x535d61]
dmd/doc.d:1091 void dmd.doc.emitComment(dmd.dsymbol.Dsymbol,
dmd.root.outbuffer.OutBuffer*, dmd.dscope.Scope*) [0x557798]
dmd/doc.d:796 void dmd.doc.emitMemberComments(dmd.dsymbol.ScopeDsymbol,
dmd.root.outbuffer.OutBuffer*, dmd.dscope.Scope*) [0x55767c]
dmd/doc.d:439 _Z10gendocfileP6Module [0x556783]
dmd/mars.d:911 int dmd.mars.tryMain(ulong, const(char)**) [0x5f8097]
dmd/mars.d:1098 _Dmain [0x5f8d92]
---

--


[Issue 18720] New: Segfault in src/gc/impl/conservative/gc.d:1990

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18720

  Issue ID: 18720
   Summary: Segfault in src/gc/impl/conservative/gc.d:1990
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: major
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: greensunn...@gmail.com

>From https://circleci.com/gh/dlang/phobos/7257

---
Program received signal SIGSEGV, Segmentation fault.
0x00b17fec in gc.impl.conservative() (this=..., ptop=0x608f670,
pbot=0x608f630) at src/gc/impl/conservative/gc.d:1990
1990auto p = *p1;
#0  0x00b17fec in gc.impl.conservative() (this=..., ptop=0x608f670,
pbot=0x608f630) at src/gc/impl/conservative/gc.d:1990
#1  0x00b188f1 in gc.impl.conservative() (this=0x7fff9b70,
__applyArg0=...) at src/gc/impl/conservative/gc.d:2188
#2  0x00b23d5d in rt.util.container.treap() (this=0x7fff9b30,
e=...) at src/rt/util/container/treap.d:47
#3  0x00b24135 in rt.util.container.treap() (dg=..., node=0x5d5c210) at
src/rt/util/container/treap.d:221
#4  0x00b24161 in rt.util.container.treap() (dg=..., node=0x5ef5950) at
src/rt/util/container/treap.d:224
#5  0x00b24161 in rt.util.container.treap() (dg=..., node=0x5ef4ec0) at
src/rt/util/container/treap.d:224
#6  0x00b24161 in rt.util.container.treap() (dg=..., node=0x5ef45b0) at
src/rt/util/container/treap.d:224
#7  0x00b24161 in rt.util.container.treap() (dg=..., node=0x5783e90) at
src/rt/util/container/treap.d:224
#8  0x00b24161 in rt.util.container.treap() (dg=..., node=0x5607660) at
src/rt/util/container/treap.d:224
#9  0x00b24161 in rt.util.container.treap() (dg=..., node=0x5905eb0) at
src/rt/util/container/treap.d:224
#10 0x00b24161 in rt.util.container.treap() (dg=..., node=0x2c35530) at
src/rt/util/container/treap.d:224
#11 0x00b24161 in rt.util.container.treap() (dg=..., node=0x1a85a40) at
src/rt/util/container/treap.d:224
#12 0x00b23d93 in rt.util.container.treap() (this=..., dg=...) at
src/rt/util/container/treap.d:52
#13 0x00b23d2f in rt.util.container.treap() (this=..., dg=...) at
src/rt/util/container/treap.d:47
#14 0x00b18870 in gc.impl.conservative() (this=..., nostack=false) at
src/gc/impl/conservative/gc.d:2185
#15 0x00b19336 in gc.impl.conservative() (this=..., nostack=false) at
src/gc/impl/conservative/gc.d:2417
#16 0x00b17479 in gc.impl.conservative() (this=..., bits=0,
alloc_size=@0x7fff9e08: 32, bin=1 '\001') at
src/gc/impl/conservative/gc.d:1711
#17 0x00b1730a in gc.impl.conservative() (this=..., bits=0,
alloc_size=@0x7fff9e08: 32, size=32) at src/gc/impl/conservative/gc.d:1676
#18 0x00b152a1 in gc.impl.conservative() (this=0xf4a250, ti=0xeb0300
,
alloc_size=@0x7fff9e08: 32, bits=0, size=32) at
src/gc/impl/conservative/gc.d:517
#19 0x00b1b35e in gc.impl.conservative() (this=0xf4a250,
_param_3=@0x7fff9e28: 0xeb0300
,
_param_2=@0x7fff9e08: 32, _param_1=@0x7fff9e30: 0,
_param_0=@0x7fff9e38: 32) at src/gc/impl/conservative/gc.d:390
#20 0x00b15343 in gc.impl.conservative() (this=0xf4a250,
__HID11=0x7fff9ee8, ti=0xeb0300
,
bits=0, size=32) at src/gc/impl/conservative/gc.d:543
#21 0x00ac8957 in gc_qalloc (__HID9=0x7fff9ee8, sz=32, ba=0,
ti=0xeb0300
)
at src/gc/proxy.d:144
#22 0x00ac8163 in core.memory.GC.qalloc() (__HID2=0x7fff9ee8,
ti=0xeb0300
,
ba=0, sz=32) at src/core/memory.d:406
#23 0x00b1eab6 in _d_newitemU (_ti=0xeb0300
)
at src/rt/lifetime.d:1102
#24 0x00acc0f9 in _d_newitemiT (_ti=0xeb0300
)
at src/rt/lifetime.d:1124
#25 0x0099c31c in std.array() (this=..., arr=...) at
/home/circleci/dmd/generated/linux/debug/64/../../../../../phobos/std/array.d:2884
#26 0x0099c21c in std.array() () at
/home/circleci/dmd/generated/linux/debug/64/../../../../../phobos/std/array.d:3406
#27 0x009a8a9c in std.array() (r=...) at
/home/circleci/dmd/generated/linux/debug/64/../../../../../phobos/std/array.d:133
#28 0x00a9f3f0 in
dscanner.analysis.mismatched_args.MismatchedArgumentCheck.visit()
(this=0x77fda7c0, fce=0x1683be8) at

[Issue 18688] Constructors shouldn't have implicit super call if it throws

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18688

Walter Bright  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---
   Severity|enhancement |normal

--- Comment #3 from Walter Bright  ---
The real problem is that delegating constructor calls are not allowed after
labels, and the case and default statements are labels. The compiler should
detect those.

The trouble with labels is the primitive flow analysis done by the compiler
cannot handle them. So they are just disallowed. Maybe a future enhancement
could cover it.

--


[Issue 2043] Closure outer variables in nested blocks are not allocated/instantiated correctly: should have multiple instances but only have one.

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2043

--- Comment #26 from Artem Borisovskiy  ---
Buckle up for celebration of 10 year anniversary and don't forget flowers for
Walter.

--


[Issue 15621] std.file.rename does not allow moving files to a different drive

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15621

Jonathan Marler  changed:

   What|Removed |Added

 CC||johnnymar...@gmail.com

--


[Issue 18719] New: Doubly-called constructor against member when using forwarding constructors

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18719

  Issue ID: 18719
   Summary: Doubly-called constructor against member when using
forwarding constructors
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: and...@erdani.com

Consider:

struct S
{
int x = -1;
this(int y) immutable
{
x = y;
import std.stdio;
writeln("Ctor called with ", y);
}
void opAssign(int) immutable;
}

class C
{
S x;
this() immutable
{
this(42); /* Initializes x. */
x = 13; /* Breaking immutable, or ok? */
}
this(int x) immutable
{
this.x = x;
}
}

void main()
{
new immutable C;
}

The code prints:

Ctor called with 42
Ctor called with 13

Constructor should not be called twice against the same object.

--


[Issue 18718] New: ICE in dmd/traits.d:417

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18718

  Issue ID: 18718
   Summary: ICE in dmd/traits.d:417
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: ice, ice-on-invalid-code
  Severity: critical
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: greensunn...@gmail.com

Reduced example (from
https://forum.dlang.org/post/uulshsgxovbrrctvd...@forum.dlang.org)

---
struct World {
mixin BuildStuff;
}

template BuildStuff() {
static foreach(elem; __traits(allMembers, typeof(this))) {

}
}
---

Stacktrace:

---
0x558ba0eb in semanticTraits(TraitsExp*, Scope*) (e=0x0, sc=0x0) at
dmd/traits.d:417
417 extern (C++) Expression semanticTraits(TraitsExp e, Scope* sc)
#0  0x558ba0eb in semanticTraits(TraitsExp*, Scope*) (e=0x0, sc=0x0) at
dmd/traits.d:417
#1  0x55824dbd in ExpressionSemanticVisitor::visit(TraitsExp*)
(this=0x7f7ff238, e=0x76971ad0) at dmd/expressionsem.d:3791
#2  0x55812c32 in TraitsExp::accept(Visitor*) (this=0x76971ad0,
v=0x7f7ff238) at dmd/expression.d:4743
#3  0x55834f4f in expressionSemantic(Expression*, Scope*)
(e=0x76971ad0, sc=0x76857e40) at dmd/expressionsem.d:9367
#4  0x5578ec45 in
_D3dmd4cond13StaticForeach7prepareMFPSQBk6dscope5ScopeZv (this=0x769719e0,
sc=0x76857e40) at dmd/cond.d:385
#5  0x55787714 in StaticForeachDeclaration::include(Scope*)
(this=0x76971940, sc=0x76857d10) at dmd/attrib.d:1083
#6  0x557de39b in
_D3dmd7dsymbol12ScopeDsymbol8_foreachFPSQBm6dscope5ScopePSQCe4root5array__T5ArrayTCQDdQDc7DsymbolZQxMDFmQwZiPmZi
(pn=0x7f7ff3c8, dg=..., members=0x76971920, sc=0x76857d10) at
dmd/dsymbol.d:1666
#7  0x557de3ef in
_D3dmd7dsymbol12ScopeDsymbol8_foreachFPSQBm6dscope5ScopePSQCe4root5array__T5ArrayTCQDdQDc7DsymbolZQxMDFmQwZiPmZi
(pn=0x0, dg=..., members=0x77e9f500, sc=0x76857d10) at
dmd/dsymbol.d:1668
#8  0x558bc8c1 in semanticTraits(TraitsExp*, Scope*) (e=0x76971ad0,
sc=0x76857d10) at dmd/traits.d:1335
#9  0x55824dbd in ExpressionSemanticVisitor::visit(TraitsExp*)
(this=0x7f7ffcc8, e=0x76971ad0) at dmd/expressionsem.d:3791
#10 0x55812c32 in TraitsExp::accept(Visitor*) (this=0x76971ad0,
v=0x7f7ffcc8) at dmd/expression.d:4743
#11 0x55834f4f in expressionSemantic(Expression*, Scope*)
(e=0x76971ad0, sc=0x76857d10) at dmd/expressionsem.d:9367
#12 0x5578ec45 in
_D3dmd4cond13StaticForeach7prepareMFPSQBk6dscope5ScopeZv (this=0x769719e0,
sc=0x76857d10) at dmd/cond.d:385
#13 0x55787714 in StaticForeachDeclaration::include(Scope*)
(this=0x76971940, sc=0x76857be0) at dmd/attrib.d:1083
#14 0x557de39b in
_D3dmd7dsymbol12ScopeDsymbol8_foreachFPSQBm6dscope5ScopePSQCe4root5array__T5ArrayTCQDdQDc7DsymbolZQxMDFmQwZiPmZi
(pn=0x7f7ffe58, dg=..., members=0x76971920, sc=0x76857be0) at
dmd/dsymbol.d:1666
#15 0x557de3ef in
_D3dmd7dsymbol12ScopeDsymbol8_foreachFPSQBm6dscope5ScopePSQCe4root5array__T5ArrayTCQDdQDc7DsymbolZQxMDFmQwZiPmZi
(pn=0x0, dg=..., members=0x77e9f500, sc=0x76857be0) at
dmd/dsymbol.d:1668
---

--


[Issue 11938] "Ifti!T" for std.traits

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11938

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--


[Issue 15206] ICE on optimized build, tym = x1d Internal error: backend\cgxmm.c 547

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15206

John Colvin  changed:

   What|Removed |Added

 CC||john.loughran.colvin@gmail.
   ||com

--- Comment #7 from John Colvin  ---
I found a different piece of code that triggers the same error:

% cat test.d:
alias A = Complex!double;

struct Complex(T)
{
double re, im;

Complex!double baz()
{
return Complex!double(re).blah;
}

ref Complex!double blah()
{
im = re;
return this;
}
}

% dmd -c -inline -O -m64 test.d
tym = x1d
Internal error: dmd/backend/cgxmm.c 684

Walter, I can produce the error for both this and the original example on both
macOS and linux (haven't tried windows). -m32 avoids the bug.

--


[Issue 18716] [ICE] type const(char)[] can not be mapped to C++

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18716

--- Comment #1 from Jacob Carlborg  ---
Pull request: https://github.com/dlang/dmd/pull/8120.

--


[Issue 18717] Segfault in BitManip

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18717

--- Comment #1 from Cédric Picard  ---
Forgot to mention that this may be related to
https://issues.dlang.org/show_bug.cgi?id=12458 although I do not the issues are
the same.

--


[Issue 18717] New: Segfault in BitManip

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18717

  Issue ID: 18717
   Summary: Segfault in BitManip
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: cpic...@openmailbox.org

The following program segfaults with dmd v2.079.0 when compiled with no
arguments in x86_64:

```
import std.bitmanip;

void main(string[] args) {
auto barray   = BitArray();
ulong evilVal = 2534886795;
barray.length = evilVal + 1;
barray[evilVal];
}
```

The segfault happens there:


╭ (fcn) sym._D4core5bitop2btFNaNbNixPmmZi 13
│   sym._D4core5bitop2btFNaNbNixPmmZi ();   
│   0x5558709cde6c  55 push rbp 
│   0x5558709cde6d  488bec mov rbp, rsp 
|   ;-- rip:
│   0x5558709cde70  0fa33e bt dword [rsi], edi  
│   0x5558709cde73  19c0   sbb eax, eax 
│   0x5558709cde75  f7d8   neg eax  
│   0x5558709cde77  5d pop rbp  
╰   0x5558709cde78  c3 ret  
0x5558709cde79     add byte [rax], al   
0x5558709cde7b  ~   005548 add byte [rbp + 0x48], dl


At that point we have:
rsi = 0x7f40163e2010   -> our BitArray
rdi = 0x97174d8b   -> "evilVal"

A look at /proc/*/maps shows that the call falls into that section:

0x7f40163e2000 # 0x7f4032928000 - usr 453.3M s -rw- unk1 unk1

IIUC this is what was allocated for our BitArray. However this isn't enough as
0x7f4032928000 - 0x7f40163e2000 < 2534886795.

Therefore my understanding is that not enough memory was allocated to hold the
BitArray even though we specified a length strictly greater than the index we
are accessing.

--


[Issue 18716] New: [ICE] type const(char)[] can not be mapped to C++

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18716

  Issue ID: 18716
   Summary: [ICE] type const(char)[] can not be mapped to C++
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: d...@me.com

The following code:

extern (C++) void foo(const(char)[]) {}

Gives the following error:

Error: Internal Compiler Error: type const(char)[] can not be mapped to C++

--


[Issue 18715] Non-documented unittests should not use unpredictableSeed or default Random alias

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18715

--- Comment #1 from Nathan S.  ---
Pull request: https://github.com/dlang/phobos/pull/6414

--


[Issue 18715] New: Non-documented unittests should not use unpredictableSeed or default Random alias

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18715

  Issue ID: 18715
   Summary: Non-documented unittests should not use
unpredictableSeed or default Random alias
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: minor
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: n8sh.second...@hotmail.com

Rationale:

https://github.com/dlang/phobos/pull/6410#discussion_r178660995
>Use a fixed seed and a fixed engine, everything else might lead to random 
>coverage changes.

Exceptions are made for public unittests that may be meant to demonstrate use
of unpredictableSeed and/or the default Random.

--


[Issue 18452] std.zip has size limit of 2 GB

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18452

--- Comment #1 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/0dc7ea22b08b317e4e5bda07d298996ecb9efa0f
Fix Issue 18452 - std.zip has size limit of 2 GB

https://github.com/dlang/phobos/commit/861e65ac5f590dd8bc12c99d07492728573a5d91
Merge pull request #6378 from johnsilver97/Issue_18452

Fix Issue 18452 - std.zip has size limit of 2 GB

--


[Issue 18452] std.zip has size limit of 2 GB

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18452

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 18714] Phobos calls localtime, which is not threadsafe

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18714

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 18714] Phobos calls localtime, which is not threadsafe

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18714

--- Comment #1 from github-bugzi...@puremagic.com ---
Commit pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/5d6bf2bdd2fac4ba5da71893d50306963326eedb
Do not call localtime. It is not threadsafe. You will randomly return wrong
times in threaded apps. Fixes Issue 18714.

--


[Issue 18714] New: Phobos calls localtime, which is not threadsafe

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18714

  Issue ID: 18714
   Summary: Phobos calls localtime, which is not threadsafe
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: default_357-l...@yahoo.de

To implement timezone handling, std.datetime.timezone calls localtime.
localtime returns a pointer to a global shared struct. This means that
subsequent calls to localtime in a second thread may overwrite the data of the
first thread before the first thread can read it, causing corruption. This can
be seen by calling localtime on two different arguments in a loop, in two
threads, and validating the result.

--


[Issue 18357] can break immutable with postblit

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18357

--- Comment #3 from anonymous4  ---
Postblit should respect type qualifiers the same way const constructor does.

--


[Issue 18713] ICE in dmd/statementsem.d:1798 with -dip1000

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18713

Seb  changed:

   What|Removed |Added

   Keywords||ice, ice-on-valid-code

--


[Issue 18713] New: ICE in dmd/statementsem.d:1798 with -dip1000

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18713

  Issue ID: 18713
   Summary: ICE in dmd/statementsem.d:1798 with -dip1000
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: blocker
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: greensunn...@gmail.com

Observed here: https://github.com/dlang/phobos/pull/4990

Reduced sample:
(Compile with -dip1000)

---
ParallelForeach!R parallel(R)(R)
{
}

void main()
{
auto arrIndex = new int;
parallel(arrIndex).each!(i => e);
}

struct ParallelForeach(R)
{
alias E = R;

alias IndexDg = int delegate(E);
int opApply(IndexDg)
{
}
}

template each(alias pred)
{
enum isForeachUnaryIterable(R)(R r)
{
foreach (a; r)
unaryFun;
};

enum isForeachIterable(R) = isForeachUnaryIterable!R;

void each(Range)(Range) if (isForeachIterable!Range)
{
}

void each()
{
}
}
---


---
0x558ca61f in StatementSemanticVisitor::visit(ForeachStatement*)
(this=0x7fff6bf8, fs=0x7fffee4d38b0) at dmd/statementsem.d:1798
1798++flde.fd.tookAddressOf;  // allocate a closure
unless the opApply() uses 'scope'
#0  0x558ca61f in StatementSemanticVisitor::visit(ForeachStatement*)
(this=0x7fff6bf8, fs=0x7fffee4d38b0) at dmd/statementsem.d:1798
#1  0x558a9522 in ForeachStatement::accept(Visitor*)
(this=0x7fffee4d38b0, v=0x7fff6bf8) at dmd/statement.d:1301
#2  0x558c5923 in statementSemantic(Statement*, Scope*)
(s=0x7fffee4d38b0, sc=0x7fffee4c7750) at dmd/statementsem.d:127
#3  0x558c5ce8 in StatementSemanticVisitor::visit(CompoundStatement*)
(this=0x7fff6ef8, cs=0x7fffee4d3cf0) at dmd/statementsem.d:236
#4  0x558a88de in CompoundStatement::accept(Visitor*)
(this=0x7fffee4d3cf0, v=0x7fff6ef8) at dmd/statement.d:908
#5  0x558c5923 in statementSemantic(Statement*, Scope*)
(s=0x7fffee4d3cf0, sc=0x7fffee4c7750) at dmd/statementsem.d:127
#6  0x558da7c0 in Semantic3Visitor::visit(FuncDeclaration*)
(this=0x7fff7870, funcdecl=0x7fffee4d3460) at dmd/semantic3.d:581
#7  0x558be8ea in
ParseTimeVisitor::visit(FuncLiteralDeclaration*)
(this=0x7fff7870, s=0x7fffee4d3460) at dmd/parsetimevisitor.d:51
#8  0x5583e0ae in FuncLiteralDeclaration::accept(Visitor*)
(this=0x7fffee4d3460, v=0x7fff7870) at dmd/func.d:3144
#9  0x558d90b1 in semantic3(Dsymbol*, Scope*) (dsym=0x7fffee4d3460,
sc=0x7fffee4ab060) at dmd/semantic3.d:83
#10 0x5582096b in ExpressionSemanticVisitor::visit(FuncExp*)
(this=0x7fff79b8, exp=0x7fffee4d3420) at dmd/expressionsem.d:2610
#11 0x558129ce in FuncExp::accept(Visitor*) (this=0x7fffee4d3420,
v=0x7fff79b8) at dmd/expression.d:4656
#12 0x55834f4f in expressionSemantic(Expression*, Scope*)
(e=0x7fffee4d3420, sc=0x7fffee4a3650) at dmd/expressionsem.d:9367
#13 0x558b2e4b in ResolveVisitor::visit(TypeTypeof*)
(this=0x7fff7ac0, mt=0x7fffee4d3360) at dmd/typesem.d:2369
#14 0x5588302a in TypeTypeof::accept(Visitor*) (this=0x7fffee4d3360,
v=0x7fff7ac0) at dmd/mtype.d:5785
#15 0x558b22a5 in resolve(Type*, Loc const&, Scope*, Expression**,
Type**, Dsymbol**, bool) (mt=0x7fffee4d3360, loc=..., sc=0x7fffee49bea0,
pe=0x7fff7b58, pt=0x7fff7b60, ps=0x7fff7b68, intypeid=false) at
dmd/typesem.d:2075
#16 0x558b07c0 in TypeSemanticVisitor::visit(TypeTypeof*)
(this=0x7fff7bd0, mtype=0x7fffee4d3360) at dmd/typesem.d:1299
#17 0x5588302a in TypeTypeof::accept(Visitor*) (this=0x7fffee4d3360,
v=0x7fff7bd0) at dmd/mtype.d:5785
#18 0x558ad393 in typeSemantic(Type*, Loc, Scope*) (t=0x7fffee4d3360,
loc=..., sc=0x7fffee49bea0) at dmd/typesem.d:147
#19 0x5587931b in Type::trySemantic(Loc const&, Scope*)
(this=0x7fffee4d3360, loc=..., sc=0x7fffee49bea0) at dmd/mtype.d:947
#20 0x55824eaa in ExpressionSemanticVisitor::visit(IsExp*)
(this=0x7fff7ec8, e=0x7fffee4d3300) at dmd/expressionsem.d:3823
#21 0x55812e62 in IsExp::accept(Visitor*) (this=0x7fffee4d3300,
v=0x7fff7ec8) at dmd/expression.d:4802
#22 0x55834f4f in expressionSemantic(Expression*, Scope*)
(e=0x7fffee4d3300, sc=0x7fffee49b600) at dmd/expressionsem.d:9367
#23 0x55852241 in InferTypeVisitor::visit(ExpInitializer*)
(this=0x7fff8008, init=0x7fffee4d32d0) at dmd/initsem.d:658
#24 0x5584fa62 in ExpInitializer::accept(Visitor*)
(this=0x7fffee4d32d0, v=0x7fff8008) at dmd/init.d:322
#25 0x5584fd24 in inferType(Initializer*, Scope*) (init=0x7fffee4d32d0,
sc=0x7fffee49b600) at dmd/initsem.d:51
#26 0x557e135a in DsymbolSemanticVisitor::visit(VarDeclaration*)
(this=0x7fff86b0, dsym=0x7fffee4d31b0) at dmd/dsymbolsem.d:583
#27 0x557b275a in VarDeclaration::accept(Visitor*)
(this=0x7fffee4d31b0, 

[Issue 18710] executable file not generated when -o- is used

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18710

Mike Franklin  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #3 from Mike Franklin  ---
I don't feel like dealing with such an insignificant issue.  Since I now
understand what was meant, I'm going to close this as invalid.

--


[Issue 18712] New: bogus "switch skips declaration" error with case in mixin

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18712

  Issue ID: 18712
   Summary: bogus "switch skips declaration" error with case in
mixin
   Product: D
   Version: D2
  Hardware: All
OS: Windows
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: r.sagita...@gmx.de

With dmd master this code produces an error:

int test(int n)
{
switch(n)
{
mixin("case 0:");
int x = 1;
return x;
case 1:
int y = 2;
return y;
default:
return -1;
}
}

swtch.d(4): Error: switch skips declaration of variable swtch.test.x at
swtch.d(7)

Workaround: move the default case before the mixin.

This was a deprecation before but went unnoticed because the code compiled with
-d as it is otherwise flooded with deprecation warnings (hint: deprecation
should either be shown just once or be disabled selectively).

--


[Issue 18710] executable file not generated when -o- is used

2018-04-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18710

--- Comment #2 from Mike Franklin  ---
The "help" output currently says:

> -o-   do not write object file

I was under the assumption that that meant it would not generate the
intermediate object files when generating the executable.  I suppose this issue
could be resolved by clarifying that it doesn't generate any binary output. 
Maybe "disable object code generation", if that's what it actually does.

--