<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62631>62631</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] Recursive initialization causes front-end to seg fault
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            cor3ntin
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          cebowler
      </td>
    </tr>
</table>

<pre>
    This is a continuation of issue #60082

After this commit:

```
commit 771ad1691ac3057df2220dd327d7cdc73ef6c6f5
Author: Corentin Jabot <corentinjabot@gmail.com>
Date:   Mon Jan 23 22:05:48 2023 +0100

 [Clang] Fix a crash when recursively callig a default member initializer.

    This fixes a regression introduced by ca61961380, that would lead
    to a segfault due to stack exhaustion when recursively calling
    a default member initializer.

    Fixes #60082

 I'm not able to  get clang to emit a stack exhaustion warning,
    which it seems like it should be able to.

    Reviewed By: shafik

 Differential Revision: https://reviews.llvm.org/D142401

```

The failing case:

```
struct A;

int f(const A&) { return 42; }

struct A {
   int x = f(A());
   A() { }
};

void foo() { A(); }
```

```
clang++_r -m64 -c t.cpp
t.cpp:6:8: warning: stack nearly exhausted; compilation time may suffer, and crashes due to stack overflow are likely [-Wstack-exhausted]
   int x = f(A());
 ^
CRASH
```

The difference is that it now takes much longer to fail and causes the host I'm running it on to crash.  In #60082 I was questioning whether or not the compiler is entitled to crash at compile time in this case.  At runtime, certainly things will go awry but you have no expectation the code will ever be executed and I don't see anything in the language that requires the compiler attempt to evaluate it at compile time.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVU1v4zYT_jX0ZWBDJm19HHyw49d4U6CX7QI9FhQ1krihSC9J2XF_fTGUHCfbYIsFDCUS5-PhMzPPyBB0ZxF3bHtgnCvnhY3aMs7Z9riQY-yd3yms3dWgX9Suue2-9jqADiBBObIdZdTOgmtBhzAiMC7yLCs5y44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