[Issue 16506] New: segfaults with std.experimental.allocator.{gc_allocator,mallocator}

2016-09-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16506

  Issue ID: 16506
   Summary: segfaults with
std.experimental.allocator.{gc_allocator,mallocator}
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: ag0ae...@gmail.com

Found by Ryan who posted to the Learn group:
http://forum.dlang.org/post/vuhulvwgtahinnknn...@forum.dlang.org

Reduced test case:

import std.experimental.allocator: dispose, makeArray;
import std.experimental.allocator.gc_allocator: GCAllocator;
import std.experimental.allocator.mallocator: Mallocator;
import std.experimental.allocator.building_blocks: FreeTree;

void f(ParentAllocator)(size_t sz)
{
  static FreeTree!ParentAllocator myAlloc;
  byte[] _payload = myAlloc.makeArray!byte(sz, 0);
  assert(_payload, "_payload is null"); /* passes */
  myAlloc.dispose(_payload);
}

version(malloc) void main()
{
  f!Mallocator(33);
  f!Mallocator(43);
}

version (gc) void main()
{
  f!GCAllocator(1);
}


Both versions segfault in Linux.

The malloc version seems to need slightly different numbers for the second
call, depending on details like the version of dmd. On my machine, compiled
with git master dmd, the segfaults occurs with a value of 41 or higher, and
2.071.1 needs 42 or higher. On DPaste, 2.071.1 needs 43 or higher.

No segfault with Windows dmd, tested in Wine.

--


[Issue 16505] Enable @nogc emplace

2016-09-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16505

Marco Leise  changed:

   What|Removed |Added

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

--


[Issue 16505] New: Enable @nogc emplace

2016-09-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16505

  Issue ID: 16505
   Summary: Enable @nogc emplace
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Keywords: CTFE
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: marco.le...@gmx.de

Phobos' emplace() cannot infer its attributes to include @nogc, if the type's
constructor cannot be run at compile-time. These two things are seemingly
unrelated, but it boils down to how supporting emplace() at compile time makes
use of language features that would be GC allocations at runtime:

if (__ctfe)
{
[…]
// GC allocation at runtime:
assert(0, "CTFE emplace doesn't support "
~ T.stringof ~ " from " ~ Args.stringof);
}
else
{
[…]
}

If "if (__ctfe)" blocks were exempted from (runtime) attribute inference, it
would work. A stop-gap-solution is to store the concatenation result in an
enum.

--


[Issue 16502] spawnProcess does not throw on exec errors

2016-09-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16502

--- Comment #2 from Roman  ---
(In reply to b2.temp from comment #1)
> Why should it ?
> 
> You can check the exit status, read stderr if your process is piped and
> throw if you like. As example can you give any language whose the process
> methods, as implemented in their standard libraries, throw ?

The example is right in the std.process: spawnProcess throws if file is not
executable or working directory does not exist.

Reading stderr and exit status is different from handling the situation where
process could not start at all.

--


[Issue 12659] Module level mixin templates conflict

2016-09-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12659

Marco Leise  changed:

   What|Removed |Added

 CC||marco.le...@gmx.de
Summary|Named mixin templates   |Module level mixin
   |conflict|templates conflict

--- Comment #1 from Marco Leise  ---
Generally, symbols mixed in at module level conflict. E.g.:

  mixin template Preparer()
  {
  bool isPrepared;
  }

when mixed into multiple modules causes conflicts when accessing `isPrepared`.
In particular `fully.qualified.module.name.isPrepared` does not help the
compiler distinguish the symbols either.

--


[Issue 16502] spawnProcess does not throw on exec errors

2016-09-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16502

--- Comment #1 from b2.t...@gmx.com ---
Why should it ?

You can check the exit status, read stderr if your process is piped and throw
if you like. As example can you give any language whose the process methods, as
implemented in their standard libraries, throw ?

--


[Issue 16504] [REG 2.072a]`dup` can't use storage class `scope` for its parameter in general

2016-09-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16504

ag0ae...@gmail.com changed:

   What|Removed |Added

 CC||ag0ae...@gmail.com
Summary|`dup` can't use storage |[REG 2.072a]`dup` can't use
   |calss `scope` for its   |storage class `scope` for
   |parameter in general|its parameter in general
   Severity|normal  |regression

--


[Issue 16504] New: `dup` can't use storage calss `scope` for its parameter in general

2016-09-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16504

  Issue ID: 16504
   Summary: `dup` can't use storage calss `scope` for its
parameter in general
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: verylonglogin@gmail.com

Currently `scope` is documented [1] as

> references in the parameter cannot be escaped

and `dup` is called for unrestricted set of types so type's postblit can assign
references from the parameter to global variable thus violating `scope` storage
class assumptions as there is no such restrictions for postblits.

This issues is cause by druntime pull #1637 [2].

[1] https://dlang.org/spec/function.html#parameters
[2] https://github.com/dlang/druntime/pull/1637

--