www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21954] New: stack corruption on if stmt taking a noreturn

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

          Issue ID: 21954
           Summary: stack corruption on if stmt taking a noreturn array
                    elem as condition
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: accepts-invalid, wrong-code
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

this code returns random return codes when executed

---
alias noreturn = typeof(*null);

int main()
{
    noreturn[1] a;
    if (a[0]){}
    return 0;
}
---

Maybe related to 21951 (initializer of noreturn).
compiled with DMD git 9d718f2f8c7f34d3b616791493d9e71d7527f221

--
May 22