[Issue 21110] New: OOB memory access, safety violation

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21110

  Issue ID: 21110
   Summary: OOB memory access, safety violation
   Product: D
   Version: D2
  Hardware: x86_64
OS: Other
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: bcarnea...@gmail.com

void main() {
import std.stdio : writeln;

int[] dst;
int[] a;
int[] b;
a.length = 3;
b.length = 3;
dst.length = 4;
dst[] = a[] + b[];
writeln(dst[3]);
}

Prior to 2.077, per Steven Schveighoffer, the above safely failed with an array
violation.  Currently on his and my test machines, the above runs to completion
printing out some number (402696894 on my machine, 402653184 on his). 
Annotating main with @safe didn't change anything.

--


[Issue 21091] [ICE] Segmentation fault: Module::importAll(Scope*) (this=0x0, prevsc=0x0) at dmd/dmodule.d:1124

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21091

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #3 from Dlang Bot  ---
@RazvanN7 created dlang/dmd pull request #11503 "Fix Issue 21091 - [ICE]
Segmentation fault: Module::importAll(Scope*)…" fixing this issue:

- Fix Issue 21091 - [ICE] Segmentation fault: Module::importAll(Scope*)
(this=0x0, prevsc=0x0) at dmd/dmodule.d:1124

https://github.com/dlang/dmd/pull/11503

--


[Issue 21109] Wrong result when using sort() on enum arrays

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21109

Andrej Mitrovic  changed:

   What|Removed |Added

Summary|Possibly wrong codegen when |Wrong result when using
   |using enum arrays   |sort() on enum arrays

--


[Issue 21109] Possibly wrong codegen when using enum arrays

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21109

--- Comment #4 from Andrej Mitrovic  ---
(In reply to Andrej Mitrovic from comment #3)
> I think this is related to `sort`. It's possible that sort compares by
> pointers if two structs are otherwise equivalent.
> 
> And then using `enum` has a different effect on arrays, possibly optimizing
> and storing the same pointer in two structs (making them equal).

Sorry the actual reasoning should be: `enum` always allocates a new array,
therefore the pointer addresses change each time.

It's possible opCmp does a value comparison first, and then a pointer
comparison.

But I don't think pointers should be compared at all.. at least not when
dealing with arrays and not naked pointers in a struct.

--


[Issue 21109] Possibly wrong codegen when using enum arrays

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21109

--- Comment #3 from Andrej Mitrovic  ---
I think this is related to `sort`. It's possible that sort compares by pointers
if two structs are otherwise equivalent.

And then using `enum` has a different effect on arrays, possibly optimizing and
storing the same pointer in two structs (making them equal).

--


[Issue 15824] 'scope' attribute ignored when making an alias to a scope delegate

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15824

Mathias LANG  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |FIXED

--- Comment #3 from Mathias LANG  ---
https://github.com/dlang/dmd/pull/10018 deprecated this.

--


[Issue 11754] Disallow changing the default parameters of overridden inherited functions

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=11754

Mathias LANG  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |WONTFIX

--- Comment #3 from Mathias LANG  ---
That seems like a pointless restriction. Closing as WONTFIX.

--


[Issue 21109] Possibly wrong codegen when using enum arrays

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21109

--- Comment #2 from Andrej Mitrovic  ---
I've confirmed the issue with ldc2 as well. So it looks like it's a front-end
bug.

--


[Issue 21109] Possibly wrong codegen when using enum arrays

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21109

--- Comment #1 from Andrej Mitrovic  ---
Using DMD v2.093.0.

--


[Issue 13112] Ignore constness when copying dynamic array argument to static array parameter

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13112

Mathias LANG  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |INVALID

--- Comment #1 from Mathias LANG  ---
The problem is not constness, but that dynamic arrays do not convert implicitly
to static array (which IMO is not an issue).
The difference you're seeing with variables is because initializer are treated
differently. I would say that this behavior is more likely to be the issue than
not having implicit conversion from static to dynamic array.
The following compiles (but obviously triggers a range error):
```
void f(char[1] arr) {}

void main()
{
string s;
f(s[0 .. 1]);
}
```

So closing as invalid.

--


[Issue 21109] New: Possibly wrong codegen when using enum arrays

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21109

  Issue ID: 21109
   Summary: Possibly wrong codegen when using enum arrays
   Product: D
   Version: D2
  Hardware: All
OS: Mac OS X
Status: NEW
  Severity: critical
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: andrej.mitrov...@gmail.com

-
import std.algorithm;
import std.stdio;

struct S
{
int i;
int[] arr;
}

void main ()
{
enum q1 = [
S(2, [0, 0]),
];

enum q2 = [
S(2, [0, 0]),
];

enum q3 = [
S(2, [1, 1]),
];

foreach (idx; 0 .. 10)  // 10 iterations
{
const unique_count = [q1, q2, q3].sort.uniq.count;
writefln("Uniques: %s", unique_count);
}
}
-

This produces:

```
$ dmd -run test.d
> Uniques: 2
Uniques: 2
Uniques: 2
Uniques: 2
Uniques: 2
Uniques: 3
Uniques: 2
Uniques: 2
Uniques: 2
Uniques: 2
```

Notice how in one run the number of uniques was 3!

If I change `enum` to `auto` the bug goes away.

--


[Issue 16479] Missing substitution while mangling C++ template parameter for functions

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16479

Mathias LANG  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #13 from Mathias LANG  ---
Moved to https://issues.dlang.org/show_bug.cgi?id=21108 as the original issue
has been mostly fixed and only a few test-cases remains, which can be worked
around.

--


[Issue 21108] New: Wrong mangling for extern(C++, std) (identifier namespace)

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21108

  Issue ID: 21108
   Summary: Wrong mangling for extern(C++, std) (identifier
namespace)
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Keywords: C++
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: pro.mathias.l...@gmail.com

Taken from: https://issues.dlang.org/show_bug.cgi?id=16479#c11

```
extern (C++, std)
struct pair(T1, T2) {}

extern (C++)
void func_20413(pair!(int, float), pair!(float, int));
```

actual:   _Z10func_20413St4pairIifEStS_IfiE
expected: _Z10func_20413St4pairIifES_IfiE

A C++ string namespace `extern (C++, "std") struct pair(T1, T2) {}` works as
expected (testcase from https://issues.dlang.org/show_bug.cgi?id=20413).

--


[Issue 21096] [ICE] Segmentation fault in dmd.hdrgen.sizeToBuffer at dmd/hdrgen.d:3153

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21096

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Dlang Bot  ---
@RazvanN7 created dlang/dmd pull request #11502 "Fix Issue 21096 - [ICE]
Segmentation fault in dmd.hdrgen.sizeToBuffer at dmd/hdrgen.d:3153" fixing this
issue:

- Fix Issue 21096 - [ICE] Segmentation fault in dmd.hdrgen.sizeToBuffer at
dmd/hdrgen.d:3153

https://github.com/dlang/dmd/pull/11502

--


[Issue 17928] [scope] `in` is not treated as `const scope`

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17928

Mathias LANG  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |FIXED

--- Comment #8 from Mathias LANG  ---
Implemented in https://github.com/dlang/dmd/pull/10769

--


[Issue 13752] add traits to query storage class of variables (isTLS, isGlobal)

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13752

Mathias LANG  changed:

   What|Removed |Added

 CC||andrej.mitrov...@gmail.com

--- Comment #1 from Mathias LANG  ---
*** Issue 12474 has been marked as a duplicate of this issue. ***

--


[Issue 12474] Implement the getStorageClass trait

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12474

Mathias LANG  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |DUPLICATE

--- Comment #4 from Mathias LANG  ---
Regarding storage class, we have getParameterStorageClass (implemented in
https://github.com/dlang/dmd/pull/6829) for parameter. For variables, we have
another issue (13752), so marking as duplicate.

*** This issue has been marked as a duplicate of issue 13752 ***

--


[Issue 7846] Forward referenced storage class is not applied in certain cases

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7846

Mathias LANG  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |FIXED

--- Comment #3 from Mathias LANG  ---
Fixed in v2.084:

```
2.063   to 2.083.1: Success with output:
-
int
true
const(int)
false
-

Since  2.084.1: Success with output:
-
const(int)
false
const(int)
false
-
```

--


[Issue 6931] scope parameter storage class not checked at all

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6931

Mathias LANG  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |FIXED

--- Comment #6 from Mathias LANG  ---
Solved by DIP1000.

--


[Issue 21092] [ICE] Segmentation fault in ExpressionPrettyPrintVisitor::visit(CommaExp*) at dmd/hdrgen.d:2293

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21092

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #2 from Dlang Bot  ---
@RazvanN7 created dlang/dmd pull request #11500 "Fix Issue 21092 -[ICE]
Segmentation fault in ExpressionPrettyPrintVis…" fixing this issue:

- Fix Issue 21092 -[ICE] Segmentation fault in
ExpressionPrettyPrintVisitor::visit(CommaExp*) at dmd/hdrgen.d:2293

https://github.com/dlang/dmd/pull/11500

--


[Issue 21107] New: Cannot define an r/w property inside a function

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21107

  Issue ID: 21107
   Summary: Cannot define an r/w property inside a function
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: por...@narod.ru

It wonders me that the following program does not compile:

void main() {
  @property int x() { return 0; }
  @property void x(int) { }
}

x.d(3): Error: declaration x is already defined

Is it a DMD v2.090.1 bug?

If it should not be compilable indeed, it is nevertheless a bug: The error
message should be more clear.

--


[Issue 21106] New: Add type inference for constructor calls

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21106

  Issue ID: 21106
   Summary: Add type inference for constructor calls
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: por...@narod.ru

I propose to add type inference (similar to one for functions) for constructor
calls, that is to make the following program legal:

class C(T) {
  this(T) { }
}

void main() {
  immutable x = new C(0);
}

This would simplify programming eliminating the need to create a factory
function or factory functions for each template class.

Pro: shorter programs.

Con: some consider it a good practice to make a factory function ALWAYS.

Pro: even if you create a factory function, the body of this function itself
would be shortened.

--


[Issue 20380] std.net.curl: misbehaviour on arch 'arm32v7 gnueabihf' (Raspberry/Raspbian/Buster)

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20380

--- Comment #9 from Iain Buclaw  ---
(In reply to Iain Buclaw from comment #8)
> GCC 10.2 is out https://gcc.gnu.org/gcc-10/

Changelog entry for std.net.curl change:

https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libphobos/ChangeLog;h=bf6eefd3bd1a8b300d9993e253a90679575fc4be;hb=ee5c3db6c5b2c3332912fb4c9cfa2864569ebd9a#l1

Built and ran dub on aarch64 server, issue no longer occurs.

--


[Issue 21105] Casting from a function pointer to a delegate

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21105

Dennis  changed:

   What|Removed |Added

 CC||dkor...@live.nl

--- Comment #1 from Dennis  ---
Are you aware of std.functional.toDelegate?
https://dlang.org/phobos/std_functional.html#toDelegate

Implicit casting to delegate probably needs a DIP or at least some good
rationale.

--


[Issue 21105] New: Casting from a function pointer to a delegate

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21105

  Issue ID: 21105
   Summary: Casting from a function pointer to a delegate
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: por...@narod.ru

Please add the following features:

- explicit casting from a function pointer to the corresponding delegate (with
the obvious semantics)
- implicit casting from a function pointer to the corresponding delegate
- `cast(delegate) ...` that would also do this cast.

The state would be set to null by such casts.

--


[Issue 20380] std.net.curl: misbehaviour on arch 'arm32v7 gnueabihf' (Raspberry/Raspbian/Buster)

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20380

Iain Buclaw  changed:

   What|Removed |Added

 Depends on||19367


Referenced Issues:

https://issues.dlang.org/show_bug.cgi?id=19367
[Issue 19367] std.net.curl does not understand HTTP/2 status lines
--


[Issue 19367] std.net.curl does not understand HTTP/2 status lines

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19367

Iain Buclaw  changed:

   What|Removed |Added

 Blocks||20380


Referenced Issues:

https://issues.dlang.org/show_bug.cgi?id=20380
[Issue 20380] std.net.curl: misbehaviour on arch 'arm32v7 gnueabihf'
(Raspberry/Raspbian/Buster)
--


[Issue 20380] std.net.curl: misbehaviour on arch 'arm32v7 gnueabihf' (Raspberry/Raspbian/Buster)

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20380

Iain Buclaw  changed:

   What|Removed |Added

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

--- Comment #8 from Iain Buclaw  ---
GCC 10.2 is out https://gcc.gnu.org/gcc-10/

--


[Issue 21089] With vm.overcommit_memory=0, DMD can't link if it uses more than half the total (ram+swap) memory in the system.

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21089

Dlang Bot  changed:

   What|Removed |Added

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

--- Comment #3 from Dlang Bot  ---
dlang/dmd pull request #11497 "Fix issue 21089: spawn linker with vfork to
avoid need to overcommit memory" was merged into master:

- c7aef70550c291928b20d3daa9bb4d643c460693 by Mathis Beer:
  Fix issue 21089: spawn linker with vfork to avoid need to overcommit memory -
dmd is large, ld is small.

https://github.com/dlang/dmd/pull/11497

--


[Issue 21089] With vm.overcommit_memory=0, DMD can't link if it uses more than half the total (ram+swap) memory in the system.

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21089

--- Comment #2 from Dlang Bot  ---
@FeepingCreature updated dlang/dmd pull request #11497 "Spawn linker with vfork
to avoid need to overcommit memory" fixing this issue:

- Fix issue 21089: spawn linker with vfork to avoid need to overcommit memory -
dmd is large, ld is small.

https://github.com/dlang/dmd/pull/11497

--


[Issue 2789] Functions overloads are not checked for conflicts

2020-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2789

Iain Buclaw  changed:

   What|Removed |Added

 CC||ibuc...@gdcproject.org

--- Comment #19 from Iain Buclaw  ---
(In reply to Witold Baryluk from comment #18)
> Interesting, gdc 9.2 does report duplicate:
> 
> :16:6: error: example.B.m at :16:6 conflicts with
> example.B.m at :12:6
> 
>16 |  int m() {
> 
> 
> 
> The issue is still present in dmd nightly, dmd 2.089, ldc 1.20, ldc trunk.
> 
> Link with an example: https://godbolt.org/z/xE6fK7

This is checked in the codegen pass.  Would be better if the front-end did it
for us.

--