www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21044] New: [CTFE] Infinite loop in ForStatement::interpret


          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 puremagic.com
          Reporter: ibuclaw 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.

Jul 13 2020