[Issue 14447] adding isRandomAccessRange!S causes std.array unittests to fail to compile

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14447

Walter Bright  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=8521

--


[Issue 8521] ICE(e2ir.c) when a function uses a template which relies on that function and -release and -inline are used

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8521

Walter Bright  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=14447
 Resolution|WORKSFORME  |---

--


[Issue 14447] New: adding isRandomAccessRange!S causes std.array unittests to fail to compile

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14447

  Issue ID: 14447
   Summary: adding isRandomAccessRange!S causes std.array
unittests to fail to compile
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: bugzi...@digitalmars.com

This bug happens in compiling Phobos unittests. To reproduce:

1. edit std\utf.d and add the lines:

pragma(msg, S);
pragma(msg, isRandomAccessRange!S);

after the lines in the wchar overload of decodeImpl() that say:

//@@@BUG@@@ 8521 forces this to be done outside of decodeImpl
//enum canIndex = is(S : const wchar[]) || (isRandomAccessRange!S &&
hasSlicing!S && hasLength!S);

2. compile std\array.d for unittests with:

dmd std\array -main -unittest

and you'll be greeted with:

dmd std\array -unittest -main
wchar[]
false
wstring
false
std\array.d(1543): Error: template std.array.split cannot deduce function from
argument types !()(wstring, string), candidates are:
std\array.d(1402):std.array.split(S)(S s) if (isSomeString!S)
std\array.d(1508):std.array.split(Range, Separator)(Range range,
Separator sep) if (isForwardRange!Range && is(typeof(ElementType!Range.init ==
Separator.init)))
std\array.d(1515):std.array.split(Range, Separator)(Range range,
Separator sep) if (isForwardRange!Range && isForwardRange!Separator &&
is(typeof(ElementType!Range.init == ElementType!Separator.init)))
std\array.d(1522):std.array.split(alias isTerminator, Range)(Range
range) if (isForwardRange!Range &&
is(typeof(unaryFun!isTerminator(range.front

Tested on Windows. Probably related to
https://issues.dlang.org/show_bug.cgi?id=8521, but I made it a separate issue
because this does not present with an ICE.

--


[Issue 14446] New: ICE on invalid import

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14446

  Issue ID: 14446
   Summary: ICE on invalid import
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: minor
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: ket...@ketmar.no-ip.org

dmd ices with the following command line:

dmd -c -o- tinycdb.d tinycdbmk.d


=== tinycdb.d ===
module iv;
struct CDB {}


=== tinycdbmk.d ===
struct CDBMaker {
import tinycdb;
}

--


[Issue 14435] [D1] backport deprecated("msg")

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14435

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

   What|Removed |Added

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

--


[Issue 14435] [D1] backport deprecated("msg")

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14435

--- Comment #1 from github-bugzi...@puremagic.com ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bc99930d1c92f997c849e5925f9f17455c7b2470
fix Issue 14435 - [D1] backport deprecated('msg')

--


[Issue 14439] aa's keys, values, byKey, byValue not usable in @safe context

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14439

Brad Roberts  changed:

   What|Removed |Added

Summary|aa's are essentially|aa's keys, values, byKey,
   |unusable in @safe contexts  |byValue not usable in @safe
   ||context

--- Comment #1 from Brad Roberts  ---
module safeaa;

void main() @safe
{
string[string] saa = [ "a" : "1", "b" : "2" ];

string s = saa["a"];

saa["c"] = "3";

if ("c" in saa) {}

size_t l = saa.length;

foreach(k; saa.keys) {}

foreach(k; saa.byKey) {}

foreach(v; saa.values) {}

foreach(v; saa.byValue) {}

}

safeaa.d(15): Error: safe function 'D main' cannot call system function
'object.keys!(string[string], string, string).keys'
safeaa.d(17): Error: safe function 'D main' cannot call system function
'object.byKey!(string[string], string, string).byKey'
safeaa.d(17): Error: safe function 'D main' cannot call system function
'object.byKey!(string[string], string, string).byKey.Result.empty'
safeaa.d(17): Error: safe function 'D main' cannot call system function
'object.byKey!(string[string], string, string).byKey.Result.popFront'
safeaa.d(17): Error: safe function 'D main' cannot call system function
'object.byKey!(string[string], string, string).byKey.Result.front'
safeaa.d(19): Error: safe function 'D main' cannot call system function
'object.values!(string[string], string, string).values'
safeaa.d(21): Error: safe function 'D main' cannot call system function
'object.byValue!(string[string], string, string).byValue'
safeaa.d(21): Error: safe function 'D main' cannot call system function
'object.byValue!(string[string], string, string).byValue.Result.empty'
safeaa.d(21): Error: safe function 'D main' cannot call system function
'object.byValue!(string[string], string, string).byValue.Result.popFront'
safeaa.d(21): Error: safe function 'D main' cannot call system function
'object.byValue!(string[string], string, string).byValue.Result.front'

I'm not sure why saa.length builds since _aaLen isn't marked @safe.  Probably
the compiler making assumptions that the code doesn't declare.

--


[Issue 12891] add atomicFetchAdd and atomicFetchSub to core.atomic

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12891

--- Comment #12 from github-bugzi...@puremagic.com ---
Commit pushed to master at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/c5f10192bb88255beec572bfc2e3510267ecd766
Merge pull request #1208 from jadbox/fetchmod

fix Issue 12891: add atomicFetchAdd to core.atomic

--


[Issue 14445] New: std.net.curl not usable in @safe code

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14445

  Issue ID: 14445
   Summary: std.net.curl not usable in @safe code
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: Phobos
  Assignee: nob...@puremagic.com
  Reporter: bra...@puremagic.com

module safecurl;

void main() @safe
{
import std.net.curl;
import std.stdio: writeln;

char[] foo = get("http://dlang.org/";);
writeln("length: ", foo.length);
}

safe-curl.d(8): Error: safe function 'D main' cannot call system function
'std.net.curl.get!(AutoProtocol, char).get'

The rest of std.net.curl is pretty much the same.. the whole module needs to be
whacked by the @safe stick.

--


[Issue 12697] -inline ICE backend\el.c 802

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12697

Martin Krejcirik  changed:

   What|Removed |Added

 CC||m...@krej.cz

--- Comment #1 from Martin Krejcirik  ---
This now gives error (with -inline only):

Error: true && (enum string defIdx = "default";
) is not an lvalue

--


[Issue 13460] dmd can no longer be built with DEBUG=1 on Linux/x86_64

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13460

Martin Krejcirik  changed:

   What|Removed |Added

   Keywords||pull
 Status|NEW |RESOLVED
 CC||m...@krej.cz
   Hardware|x86 |x86_64
 Resolution|--- |FIXED

--


[Issue 14444] New: Segfault in GC.malloc

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=1

  Issue ID: 1
   Summary: Segfault in GC.malloc
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: major
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: mkline.o...@gmail.com

I'm working with a coworker on a small utility that involves building an HTML
report of differences in ELF files. We are accomplishing this in part with ddmp
(https://github.com/francais01/ddmp). Suffice to say that lots of dynamic
arrays are involved.

I was doing some minor refactoring and changed something that looked like

foreach (line; aPipe.byLine) {
// Several line.idup calls to get strings
}

to the more efficient

foreach (line; aPipe.byLineCopy) {
// No more need for .idup to get strings
}

Much to my dismay, the program started segfaulting. I fired up GDB and got the
following trace:

Program received signal SIGSEGV, Segmentation fault.
0x77459e7e in __memset_avx2 () from /usr/lib/libc.so.6
(gdb) where
#0  0x77459e7e in __memset_avx2 () from /usr/lib/libc.so.6
#1  0x005d3ef9 in gc.gc.GC.malloc(ulong, uint, ulong*, const(TypeInfo))
(this=0x8568a0 , ti=0x82aa70 ,
alloc_size=0x7fffcb90, bits=8, size=82673) at src/gc/gc.d:459
#2  0x005a671d in gc_qalloc (__HID12=0x7fffcbf8, sz=82673, ba=8,
ti=0x82aa70 ) at src/gc/proxy.d:196
#3  0x005a4d2f in core.memory.GC.qalloc(ulong, uint, const(TypeInfo))
(__HID2=0x7fffcc68, ti=0x82aa70 , ba=8,
sz=82673) at src/core/memory.d:368
#4  0x005dbc78 in rt.lifetime.__arrayAlloc(ulong, const(TypeInfo),
const(TypeInfo)) (__HID15=0x7fffcd20, tinext=0x82a9e0
, ti=0x82aa70
, arrsize=82656)
at src/rt/lifetime.d:441
#5  0x005aaec5 in _d_arraycatnTX (ti=0x82aa70
, arrs=...) at src/rt/lifetime.d:2206
#6  0x00597b20 in ddmp.util.insert!(ddmp.diff.Diff).insert(ref
ddmp.diff.Diff[], long, ddmp.diff.Diff[]) (stuff=..., i=2821,
array=0x7fffd1d0) at ddmp/source/ddmp/util.d:47
...

The code in frame 6 is just a simple concatenation of a dynamic array and two
slices of another:

void insert(T)( ref T[] array, long i, T[] stuff)
{
assert(i <= array.length);
array = array[0..i] ~ stuff ~ array[i..$];
}

I started digging into the garbage collector, but somewhat unsurprisingly, it
is a complex and stateful beast, so I wasn't able to make much headway in the
limited time I have at work. You'll notice the segfault takes place on the
memset in GC.malloc, so one could only assume that the garbage collector thinks
it has some memory it doesn't and blows up when trying to write over it.
Attempts to learn more using valgrind were hampered by lots of alerts coming
from the GC such as small invalid reads and conditional jumps or moves
depending on uninitialized variables. (This is also concerning.)

If there is some way I can produce a dump of the GC heap or any other useful
data, please let me know.

We're on dmd 2.067 using different flavors of Linux (Arch and OpenSUSE 13.2),
FWIW.

--


[Issue 14443] New: [Reg 2.067.0] Incorrect double freeing of reference counted struct

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14443

  Issue ID: 14443
   Summary: [Reg 2.067.0] Incorrect double freeing of reference
counted struct
   Product: D
   Version: unspecified
  Hardware: All
OS: All
Status: NEW
  Severity: regression
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: c...@dawg.eu

cat > bug.d << CODE
import std.typecons;

struct Path
{
struct Payload
{
int p;
}
RefCounted!Payload _data;

unittest
{
auto path = Path(RefCounted!Payload(12));
assert(path._data.p == 12);
foreach(element; PathRange(path)) {}
}
}

struct PathRange
{
Path path;
size_t i;

@property empty()
{
return i > 2;
}

void popFront()
{
++i;
}

@property PathElement front()
{
return PathElement(this, path._data.p);
}
}

struct PathElement
{
PathRange range;

this(PathRange range, int)
{
this.range = range;
}
}
CODE

dmd -main -unittest -run bug


This code works with 2.066.1 but segfaults with 2.067.0, apparently because the
refcount of _data in path drops to 0 while it's still used.
My malloc implementation also complains about a double free.

--


[Issue 14433] std.encoding does not support Central European ISO-8859-2 and CP1250 encodings

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14433

--- Comment #1 from Tomáš Chaloupka  ---
https://github.com/D-Programming-Language/phobos/pull/3173

--


[Issue 14424] [REG2.066] dmd crashes with __traits(getUnitTests)

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14424

Martin Krejcirik  changed:

   What|Removed |Added

 CC||m...@krej.cz
   Hardware|x86_64  |All
Summary|dmd crashes with|[REG2.066] dmd crashes with
   |__traits(getUnitTests)  |__traits(getUnitTests)

--


[Issue 14424] dmd crashes with __traits(getUnitTests)

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14424

Andrei Alexandrescu  changed:

   What|Removed |Added

 CC||and...@erdani.com
   Severity|critical|regression

--


[Issue 14402] std.conv.emplace segfaults for nested class

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14402

weaselcat  changed:

   What|Removed |Added

 CC||r9shacklef...@gmail.com

--


[Issue 14425] Indirect template instantiation within is expression causes missing linker symbols

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14425

Kenji Hara  changed:

   What|Removed |Added

   Keywords||link-failure, pull
   Hardware|x86_64  |All
 OS|Linux   |All

--- Comment #2 from Kenji Hara  ---
In Windows, `-m64` or `-m32 -g` can reproduce same link-failure.

https://github.com/D-Programming-Language/dmd/pull/4587

--


[Issue 13742] undefined reference to __coverage

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13742

Martin Nowak  changed:

   What|Removed |Added

   Priority|P1  |P4

--


[Issue 13742] undefined reference to __coverage

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13742

--- Comment #3 from Martin Nowak  ---
(In reply to jiki from comment #2)
> I hit this on Windows.
> Reduced test case is here.

Also confirmed for linux.
A temporary workaround for your case is to only generate a single object file.

dmd -cov -g -c -oftmp.o test.d f.d
dmd -cov -g -main tmp.o

Hope that also works on Windows.

--


[Issue 14431] [REG 2.067.0] huge slowdown of compilation speed

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14431

Martin Krejcirik  changed:

   What|Removed |Added

 CC||m...@krej.cz

--- Comment #4 from Martin Krejcirik  ---
I'm not sure how relevant this is to the general compilation speed, but anyway:

import  std.regex;

auto RE_VARSET = regex(r"(?

[Issue 14442] Wrong this.outer reference in nested classes

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14442

--- Comment #3 from Iain Buclaw  ---
(In reply to Dicebot from comment #2)
> Is it effectively another manifestation of "have one context pointer, need
> many" issue?

Maybe... though in this scenario you can get away with just the one context
pointer:

anonclass this
{
void *this (bar.__closptr)
{
Foo35 this
{
int x = 42;
}
int y = 43;
}
}


So you know that the following:

assert(x == 42);
assert(y == 43);

Is lowered to:

assert((cast(Foo35)(*cast(CLOSURE bar *)this.this)).x == 42);
assert((cast(CLOSURE bar *)this.this).y == 43);

--


[Issue 14442] Wrong this.outer reference in nested classes

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14442

Dicebot  changed:

   What|Removed |Added

 CC||pub...@dicebot.lv

--- Comment #2 from Dicebot  ---
Is it effectively another manifestation of "have one context pointer, need
many" issue?

--


[Issue 14442] Wrong this.outer reference in nested classes

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14442

--- Comment #1 from Iain Buclaw  ---
Also affects the debug code written.  As all you see of this parent chain is
garbage values.


(gdb) p this
$1 = (__anonclass1 &) @0x77ed5fc0:
{
   = {
__vptr = 0x4890e0 ,
__monitor = 0x0
  },
  this = @0x77ed6ff0// <-- closure pointer
}
(gdb) p this.this
$2 = (Foo35 &) @0x77ed6ff0:
{
   = {
__vptr = 0x77ed5fe0,// <-- Foo35 object reference
__monitor = 0x2b// <-- 'y' value
  },
  x = 0// <-- Excess garbage
}

--


[Issue 14442] Wrong this.outer reference in nested classes

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14442

Iain Buclaw  changed:

   What|Removed |Added

   Keywords||accepts-invalid, diagnostic
 CC||ibuc...@gdcproject.org

--


[Issue 14442] New: Wrong this.outer reference in nested classes

2015-04-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14442

  Issue ID: 14442
   Summary: Wrong this.outer reference in nested classes
   Product: D
   Version: D1 & D2
  Hardware: All
OS: Linux
Status: NEW
  Severity: major
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: ibuc...@gdcproject.org

This is an extension of runnable/nested.d:test35()

---
class Foo35
{
   int x = 42;
   void bar()
   {
  int y = 43;
  new class Object
  {
 this()
 {
//writefln("x = %s", x);
//writefln("y = %s", y);
assert(x == 42);
assert(y == 43);
assert(this.outer.__monitor is null); // <-- nested.d(14):
Assertion failure
 }
  };
   }
}

void test35()
{
Foo35 f = new Foo35();
f.bar();
}
---

The place in marked above will assert at runtime because it's value is '43'. 
This tells us that the frontend thinks that the parent chain of the inner class
should be 'Foo35' and not the closure that 'Foo35.bar' creates.

What should happen is that a compiler error be issued.

nested.d(14): Error: no property '__monitor' for type 'void*'

--