[Issue 21044] New: [CTFE] Infinite loop in ForStatement::interpret

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 13 07:33:25 UTC 2020


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

          Issue ID: 21044
           Summary: [CTFE] Infinite loop in ForStatement::interpret
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

Found on one iteration of mechanically reduced code (still dozens of files,
thousands of lines of code). Will copy it and reduce it further, but I suspect
that the final product will be code that looks like:

---
int foo()
{
    for (;;) { }
    return 0;
}

static assert(foo() == 0);
---

If that is the case, then the compiler really should have proper detection for
this, to bail and error out if it finds a loop that never exits during CTFE.

--


More information about the Digitalmars-d-bugs mailing list