[Issue 13801] Garbage collector fails to work after lots of small allocations

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13801

calex  changed:

   What|Removed |Added

 CC||calex+bugzilla-mail@aristow
   ||eb.net

--


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

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2043

calex  changed:

   What|Removed |Added

 CC||calex+bugzilla-mail@aristow
   ||eb.net

--


[Issue 17635] [REG 2.066.0] cannot convert unique immutable(int)** to immutable

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17635

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

https://github.com/dlang/dmd/commit/983a02eea143b1e314ad24493cc5691a3b143667
fix Issue 17635 - [REG 2.066.0] cannot convert unique immutable(int)** to
immutable

https://github.com/dlang/dmd/commit/0615ca3302da7393067a6e0c9d8ca61ab65062a6
Merge pull request #7179 from WalterBright/fix17635

fix Issue 17635 - [REG 2.066.0] cannot convert unique immutable(int)*…
merged-on-behalf-of: Andrei Alexandrescu 

--


[Issue 17635] [REG 2.066.0] cannot convert unique immutable(int)** to immutable

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17635

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

   What|Removed |Added

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

--


[Issue 17868] add pragma(crt_con/destructor)

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17868

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #8 from Walter Bright  ---
What's the difference between this and `shared static this()` ?

--


[Issue 17880] New: Build of dlang.org affected by presence of ~/dmd.conf

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17880

  Issue ID: 17880
   Summary: Build of dlang.org affected by presence of ~/dmd.conf
   Product: D
   Version: D2
  Hardware: All
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: and...@erdani.com

To reproduce, create an empty file ~/dmd.conf and attempt to build dlang.org:

$ touch ~/dmd.conf
$ cd /path/to/dlang.org
$ make -f posix.mak
...
.generated/stable_dmd-2.072.2/dmd2/linux/bin64/dub build --single
--compiler=.generated/stable_dmd-2.072.2/dmd2/linux/bin64/dmd
assert_writeln_magic.d
Failed to invoke the compiler
.generated/stable_dmd-2.072.2/dmd2/linux/bin64/dmd to determine the build
platform: Error: cannot find source code for runtime library file 'object.d'
   dmd might not be correctly installed. Run 'dmd -man' for installation
instructions.
   config file: /home/andrei/dmd.conf
Specify path to file 'object.d' with -I switch

When dmd.conf contains (as is often the case) paths to some working
directories, the error messages become correspondingly more confusing.

When dub takes the --compiler switch, it should invoke the compiler with the
config found in its own path.

--


[Issue 17868] add pragma(crt_con/destructor)

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17868

--- Comment #7 from Martin Nowak  ---
Let's drop the priority for now, too much hassle to debug OMF and optlink,
wasn't supportable on OSX anyhow.

--


[Issue 17868] add pragma(crt_con/destructor)

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17868

Martin Nowak  changed:

   What|Removed |Added

Summary|add |add
   |pragma(crt_con/destructor[, |pragma(crt_con/destructor)
   |priority])  |

--


[Issue 17879] UFCS can enable some forms of hijacking

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17879

Jonathan M Davis  changed:

   What|Removed |Added

 CC||issues.dl...@jmdavisprog.co
   ||m

--- Comment #2 from Jonathan M Davis  ---
How is that hijacking? When you use UFCS, you're saying that it should call the
member function with that name, and if there is no member function, then it
tries to call a matching free function. Anything else would make it impossible
to use a member function and a free function for the same functionality, and if
you reversed it so that it used UFCS instead, that would make it so that you
couldn't call the member function.

It was my understanding that UFCS was purposefully designed this way, and I
don't see how doing anything else makes sense. If you want to guarantee that
you're calling a free function rather than a member function, then just don't
use UFCS.

--


[Issue 17879] UFCS can enable some forms of hijacking

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17879

--- Comment #1 from Walter Bright  ---
More discussion:

  https://github.com/tgehr/d-compiler/pull/1#discussion-diff-89697186L85

--


[Issue 17879] New: UFCS can enable some forms of hijacking

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17879

  Issue ID: 17879
   Summary: UFCS can enable some forms of hijacking
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: bugzi...@digitalmars.com

>From Timon Gehr:

struct S{
// string foo(){ return "hijacked!"; } // uncomment to hijack
}

string foo(S s){ return "not hijacked!"; }

void main(){
S s;
import std.stdio;
writeln(s.foo());
}

--


[Issue 17878] New: Add __traits(isFuture, ...)

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17878

  Issue ID: 17878
   Summary: Add __traits(isFuture, ...)
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: greensunn...@gmail.com

There is currently no way to test whether a particular symbol is going to be
introduced. It might be worthwhile to investigate whether this could be part of
getFunctionAttributes
(https://dlang.org/spec/traits.html#getFunctionAttributes).

See also: https://issues.dlang.org/show_bug.cgi?id=17791

--


[Issue 17791] Add __traits(isDeprecated, ...)

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17791

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #3 from Seb  ---
> Ditto for @future

https://issues.dlang.org/show_bug.cgi?id=17878

--


[Issue 17869] scope class object no longer deleted when created via factory function

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17869

--- Comment #2 from Rainer Schuetze  ---
scope class references are not supposed to be safe so far. The current spec
explicitly says the destructor is called: "This means that the destructor for
an object is automatically called when the reference to it goes out of scope.
The destructor is called even if the scope is exited via a thrown exception,
thus scope is used to guarantee cleanup."

That might not be consistent with scope as it is used by DIP1000, but changing
its meaning should at least have some notification in the changelog. IMO
-dip1000 should prohibit unsafe usage, though.

See also discussion in
https://github.com/ldc-developers/ldc/pull/2252#issuecomment-60596

--


[Issue 17877] Missing library path in LDC settings

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17877

Rainer Schuetze  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||r.sagita...@gmx.de
 Resolution|MOVED   |---

--- Comment #2 from Rainer Schuetze  ---
It's a Visual D issue, so it's appropriate here.

Detection of the Windows SDK is failing for the Win 10 SDK, the slightly more
exact entry for it would be

$(WindowsSDKDir)Lib\$(WindowsSDKVersion)\um\x64

--


[Issue 17869] scope class object no longer deleted when created via factory function

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17869

Mathias Lang  changed:

   What|Removed |Added

 CC||mathias.l...@sociomantic.co
   ||m

--- Comment #1 from Mathias Lang  ---
This should have never worked to begin with!
Slightly modifying your example to expose the bug:

```
import core.stdc.stdio;

void foo()
{
scope baseKey = Key.getKey();
}

int main(string[] argv)
{
printf("main init\n");
foo();
printf("main exit\n");
assert(Key.global !is null);
return 0;
}

class Key
{
private:
this() { printf("ctor\n"); }
~this() { printf("dtor\n"); }

static Key global;
static Key getKey() { return (global = new Key()); }
}
```

As you can see, in here the compiler has no way to know it *should* destroy
`baseKey` at the end of the `foo` function. And `scope` in this case is
misleading, as the `scope` reference is GC-allocated anyway.

--


[Issue 17791] Add __traits(isDeprecated, ...)

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17791

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

https://github.com/dlang/dmd/commit/9e131398d7f8c7a296fecda942f77c336c7bd611
fix issue 17791 - add __traits(deprecated, symbol)

https://github.com/dlang/dmd/commit/70d909eea541d528bb4835bef30db8a7d889ed1b
Merge pull request #7178 from dunkyp/master

fix issue 17791 - add __traits(deprecated, symbol)

--


[Issue 17877] Missing library path in LDC settings

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17877

Seb  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||greensunn...@gmail.com
 Resolution|--- |MOVED

--- Comment #1 from Seb  ---
This is the issue tracker for DMD, Druntime and Phobos.
Please report LDC issues at their own issue tracker:
https://github.com/ldc-developers/ldc/issues

Thanks!

--


[Issue 17876] [REG 2.074] Internal error when comparing inout(Foo[][]) with Foo[][]

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17876

Steven Schveighoffer  changed:

   What|Removed |Added

 CC||schvei...@yahoo.com

--- Comment #3 from Steven Schveighoffer  ---
this should compile, size_t[][] has a valid ordering.

If the ice is fixed, and this doesn't compile, please file another bug report.

--


[Issue 9614] Uninitialized holes in function stack frames confuses GC

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9614

Eugene Wissner  changed:

   What|Removed |Added

 CC||be...@caraus.de

--- Comment #2 from Eugene Wissner  ---
This problem affects dmd, with or without -m32, and ldc aswell.

When referencing memory via a variable on the stack, by the time the garbage
collector runs, due to alignment and =voids the stack reference to the variable
has not necessarily been overwritten. As a result, memory may be kept alive by
garbage pointers.

Even calling the GC manually high up the stack does not necessarily solve this,
as by the time the GC determines the stack pointer, it's already several
stackframes down from usercode.

This is especially problematic if the pointer is to a heavily-crossreferenced
data structure, such as an XML tree, where a single pointer anywhere into the
tree may keep the whole thing alive.

The correct solution would be to find a way to make stack garbage collection
type-aware; however, the mechanics of this heavily depend on the compiler
backend.

A compiler-level workaround may be to add a flag to zero any gaps in the stack
and initialize void variables to 0.

Alternatively, a user-level workaround may be to periodically wipe the stack
somewhere early in the calltree.


import core.memory, std.stdio, core.thread;

void test() {
  // Allocate some memory and store it on a variable on the stack.
  auto array = new ubyte[128*1024*1024];
  // The variable's lifetime ends here.
}

void purify() {
  ubyte[0x1000] filler = void;
  import core.stdc.string: memset;
  // To ensure the compiler doesn't optimize out the unused variable, zero it
manually.
  memset(filler.ptr, 0, 0x1000);
}

void main() {
  writeln("Allocate 100MB");
  auto before = GC.stats.usedSize;
  test();
  // purify();
  GC.collect();
  auto after = GC.stats.usedSize;
  assert(after < before + 100*1024*1024, "GC failed to free the allocation!");
  writeln("GC successfully freed allocated memory.");
}

--


[Issue 10240] It should be possible to check exists and isDir/isFile with a single stat call

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10240

--- Comment #4 from ZombineDev  ---
> I believe the right solution add a function akin to C++17's file_status 
> (http://en.cppreference.com/w/cpp/experimental/fs/file_status)

Here I meant this function:
http://en.cppreference.com/w/cpp/experimental/fs/status

as file_status is a struct.

--


[Issue 10240] It should be possible to check exists and isDir/isFile with a single stat call

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10240

--- Comment #3 from ZombineDev  ---
> while a single function returning a struct would be much more useful...

... and more type-safe.

--


[Issue 10240] It should be possible to check exists and isDir/isFile with a single stat call

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10240

ZombineDev  changed:

   What|Removed |Added

 CC||petar.p.ki...@gmail.com

--- Comment #2 from ZombineDev  ---
I believe the right solution add a function akin to C++17's file_status
(http://en.cppreference.com/w/cpp/experimental/fs/file_status) which would
return a struct essentially being union of

https://msdn.microsoft.com/en-us/library/windows/desktop/aa364946(v=vs.85).aspx
on Windows

and 

http://pubs.opengroup.org/onlinepubs/009695399/functions/stat.html on Posix.

That way users would be to obtain more information in a single call.

Unfortunately we have all kinds of functions defined in
https://dlang.org/phobos-prerelease/std_file General, Attributes, Timestamp

while a single function returning a struct would be much more useful.

--


[Issue 10240] It should be possible to check exists and isDir/isFile with a single stat call

2017-10-05 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10240

--- Comment #1 from RazvanN  ---
There are 2 ways to solve this:

1. Either check that the file or directory exists inside the isDir/isFile
functions and return false if the path does not exist or the input string
doesn't designate a directory/file. This is troublesome since you have one
value for 2 different semantics.

2. Create a function existsAndIsDir/File where you can call stat a single time.
This means adding 2 new functions that add no extra functionality for the
benefit of a micro-optimization.

In my opinion we should close this as WONTFIX.

--