www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20890] New: parameter corruption when other parameter is a

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: nobody puremagic.com
          Reporter: b2.temp 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 <seb wilzba.ch>
 Date:   Thu Feb 14 00:01:34 2019 +0100
 

     
     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 160000
 --- a/dmd
 +++ b/dmd
    -1 +1   
 -Subproject commit 73fcf82ae1d6f0582c19e8c2ae0d09f319745521
 +Subproject commit c2c6b4b6eaa4f80db2292f8c2ecf2cd250367e72
 digger: Bisection completed successfully.
--
Jun 01 2020