[Issue 20892] [REG2.086] ElfFile comparison suboptimal

2020-06-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20892

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #1 from Walter Bright  ---
Does this mean your specific code can be fixed by adding a MMapRegion.opEquals
function?

Given that this was merged nearly a year ago, I expect there'd be more silent
breakage if it was reverted.

--


[Issue 20893] [REG 2.087] 32-bit arithmetic goes wrong

2020-06-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20893

--- Comment #2 from Basile-z  ---
according to digger, caused by https://github.com/dlang/dmd/pull/9722

full bisection report:

> digger: Finding shortest path between 
> 717f0aba51531c140d1a41ff8da3020443b6d523 > and 
> 2e4afcd30657009f75394aaead63721c5eac0e38...
> digger: 0 commits (about 0 tests) remaining.
> digger: 2e4afcd30657009f75394aaead63721c5eac0e38 is the first bad commit
> commit 2e4afcd30657009f75394aaead63721c5eac0e38
> Author: Walter Bright 
> Date:   Sat Apr 27 22:04:40 2019 -0700
> 
> dmd: Merge pull request #9722 from WalterBright/cod2-const2
> 
> https://github.com/dlang/dmd/pull/9722
> 
> cod2.c: improve details a bit pt 2
> 
> diff --git a/dmd b/dmd
> index d8d17ee3e..9203ab647 16
> --- a/dmd
> +++ b/dmd
> @@ -1 +1 @@
> -Subproject commit d8d17ee3efcdd53b39f29530879fde77980ab18b
> +Subproject commit 9203ab6477f4c8e816c60803112a554d19499f4d
> digger: Bisection completed successfully.

--


[Issue 20890] parameter corruption when other parameter is a static array of length 1

2020-06-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20890

Dlang Bot  changed:

   What|Removed |Added

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

--- Comment #2 from Dlang Bot  ---
dlang/dmd pull request #11207 "fix issue 20890 - parameter corruption when
other parameter is a stat…" was merged into stable:

- 5a597997bd4d6194320f05be93754321dc05fdf9 by Nils Lankila:
  fix issue 20890 - parameter corruption when other parameter is a static array
of length 1

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

--


[Issue 20893] [REG 2.087] 32-bit arithmetic goes wrong

2020-06-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20893

Basile-z  changed:

   What|Removed |Added

   Keywords||wrong-code
 CC||b2.t...@gmx.com
 OS|Windows |All

--- Comment #1 from Basile-z  ---
reduced w/o phobos, test case is a "runnable" TC:

---
#!dmd -O -inline -m32

int f (int n)
{
foreach (i; 0..n) {}
return 10;
}

int c (int a, int b)
{
return (f(a) * 1L * f(b)) % 1000;
}

void main ()
{
int[] a = [1];
assert(c(2 - 1, 2) == 100);
}
---

--


[Issue 20893] New: [REG 2.087] 32-bit arithmetic goes wrong

2020-06-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20893

  Issue ID: 20893
   Summary: [REG 2.087] 32-bit arithmetic goes wrong
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: ga...@mail.ru

Somewhat reduced test case:

-
module bug_example;

int f (int n) {
foreach (i; 0..n) {
}
return 10;
}

int c (int a, int b) {
return (f(a) * 1L * f(b)) % 1000;
}

void main () {
auto a = [2];
foreach (n; a) {
int res = c(n - 1, n);
import std.stdio: writeln;
writeln(res);
}
}
-

Compile with "dmd -O -inline".

With 2.086.0, it produces the correct result (100).
With 2.087.1 and further, the result is wrong (10).
The bug shows with "-m32" and with "-m32mscoff"; no bug seen with "-m64".

The "* 1L *" part is conversion to long for multiplication.
Goes the same with "cast(long) f(a)" instead.
After "% 1000", it is (well, should have been) safe to treat the result as int.

Ivan Kazmenko.

--


[Issue 20892] New: [REG2.086] ElfFile comparison suboptimal

2020-06-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20892

  Issue ID: 20892
   Summary: [REG2.086] ElfFile comparison suboptimal
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: regression
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: johanenge...@weka.io

The alias_this-->opEquals change (
https://dlang.org/changelog/2.086.0.html#alias_this_opEquals) silently resulted
in ElfFile comparison potentially comparing a lot of memory, instead of pointer
comparison as before.

It concerns core.internal.elf.io.ElfIO.ElfFile, member MMapRegion!Elf_Ehdr
ehdr.

Snippet:
```
struct MMapRegion(T)
alias data this;

private ubyte[] mappedRegion;
const(T)* data;
```

Before 2.086, only MMapRegion.data would be compared (pointer comparison), but
since 2.086 now the whole mappedRegion is compared (potentially). Quick
checking of druntime's dynamic array comparison and glibc memcmp showed that
there is no short circuit for when the pointers of the slices are equal.

--


[Issue 20890] parameter corruption when other parameter is a static array of length 1

2020-06-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20890

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #1 from Dlang Bot  ---
@NilsLankila created dlang/dmd pull request #11207 "fix issue 20890 - parameter
corruption when other parameter is a stat…" fixing this issue:

- fix issue 20890 - parameter corruption when other parameter is a static array
of length 1

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

--


[Issue 20891] New: Android GC signals set inappropriately

2020-06-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20891

  Issue ID: 20891
   Summary: Android GC signals set inappropriately
   Product: D
   Version: D2
  Hardware: All
OS: Other
Status: NEW
  Severity: minor
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: alphaglosi...@gmail.com

During initialization of the runtime, threading will set a couple of signals on
POSIX for handling of suspension and resuming.

On Android it will override whatever signals the end developer may have set.

Because the setting of what signals to use must have been set prior to the
function call and cannot be changed afterwards, overriding the global
pre-existing values (which could be zero or the user specified ones), you are
forced to use whatever druntime chooses interfering with other libraries.

Function in question: thread_init
Function to override (by user): thread_setGCSignals

--


[Issue 20890] New: parameter corruption when other parameter is a static array of length 1

2020-06-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20890

  Issue ID: 20890
   Summary: parameter corruption when other parameter is a static
array of length 1
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: wrong-code
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: b2.t...@gmx.com

example must run without assertion failure

---
void format(string spec, S[1] s)
{
assert(spec.length);
}

struct S {}

void main()
{
  S[1] s;
  format("lengthy", s);
}
---

this is a DMD backend regression caused by
https://github.com/dlang/dmd/pull/9357.

full bisection report:

> digger: Clearing temporary cache
> digger: -- Running test command... ---
> digger: - Test command exited with status -11 (BAD). -
> digger: Finding shortest path between 
> 054b8cd7b68d32ac134e52c1e8cfb54210b6484e > and 
> 27c7650e74799e0f796116f9cc734c365ab3ecf0...
> digger: 0 commits (about 0 tests) remaining.
> digger: 27c7650e74799e0f796116f9cc734c365ab3ecf0 is the first bad commit
> commit 27c7650e74799e0f796116f9cc734c365ab3ecf0
> Author: Sebastian Wilzbach 
> Date:   Thu Feb 14 00:01:34 2019 +0100
> 
> dmd: Merge pull request #9357 from WalterBright/fix19672
> 
> https://github.com/dlang/dmd/pull/9357
> 
> fix Issue 19672 - Function uses the stack to read a static array para…
> 
> diff --git a/dmd b/dmd
> index 73fcf82ae..c2c6b4b6e 16
> --- a/dmd
> +++ b/dmd
> @@ -1 +1 @@
> -Subproject commit 73fcf82ae1d6f0582c19e8c2ae0d09f319745521
> +Subproject commit c2c6b4b6eaa4f80db2292f8c2ecf2cd250367e72
> digger: Bisection completed successfully.

--