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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Broken __attribute__ syntax followed by a parenthesized list is parsed as an initializer and asserts with a null Initializer
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    https://godbolt.org/z/Wq5Ksnooe (`-O0`)

```c
int a __attribute__ ) (1, 2);
```
```
<source>:1:20: error: expected '(' after 'attribute'
clang: clang/lib/Sema/SemaInit.cpp:6931: void clang::InitializationSequence::InitializeFrom(...): Assertion `Initializer && "Initializer must be non-null"' failed.
 #10 clang::InitializationSequence::InitializeFrom(...)
 #11 clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool)
 #12 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(...)
```

After the `expected '('` error the parser recovers, sees `(1, 2)` after the declarator and treats it as a parenthesized (C++-style) initializer. That path produces no initializer expression for C, but `AddInitializerToDecl` is still called with a null `Expr`. `int a __attribute__ ) (1);` and `int a __attribute__ ) 1;` are diagnosed normally. Clang trunk, assertions build.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVMFu2zgQ_ZrxZRCBIm3ZOuigJBWw2MMu0AJ7DChxbHNLkypJpXG-fjGy3SjpopcCAjSi5nHezHukTskePFEDm3vYPK70lI8hNoMes7be0ynUsparPphzc8x5TKBakB3I7hBMH1wuQjyA7F5Bdv982_yZfAiEIHdQibu_BFQCZA2i5acSl2cA0VqfUePTk8452n7K9PSEIGtGliAfUDJM3S9hH2P1kMIUBwL1CVRbgmqlANUixRjiHLyMNGQyCHLLjOQW9T5T5O8fdfmfaAen_YExl0B2zvYgu8900tfXH97mYhhHUG1VK66Gz8EavCFBtZxitbOvOtvgP9O3iTzTe_ePuhhOIHdFUcwtttimRJERCJV4y2OaFcgKQcrl6mlKGXtCH_ydn5wDKbmzvbaOTAGiRZCqFL9L7LpPudxnHscctcYsOH0JjzQ4kLtF7mWlZS0Xq59exnhd7UNwi0Jymfa3joniIubddJzptyzh7TvE1pv2pmVa0n_nFdHOMMxH4in_7AyoxMU4c8o418dIQ3immJhuIko423lh0EpcHcUg84MTam8wR9I5oc2oE2reknw-UrKvc93dA8h7kPd3KZ8dsfXt20AL_HLUGUedjzjGYKaBEvqwTGF3R0qJfbMPER_mmU6ZOf6vOpVAmzBl6xwO2jky-N3mI2pkFzFsFqcSBce_Pp_z0eTmvflVcnlLi4TG6oMPiQz6EE_auXOBD6w45jj5r8xe3w5Cwn6yzhQr0yhTq1qvqCm3u7relVKp1bExJEhrPej9ZpBqp8Te6EpX-16INQ3bcmUbKWQlalmKWgilinVZbc263A272gzrbQlrQSdtXeHc84nvsJVNaaJGyo1Yb1ZO9-TS7VKMDWfd9dMhwVo4m3J6w2Wb3Xx9Xvy7ecT7GL6S_zCPdPZZv-A-OBe-k8H-_JMpeGPWaHafmW3j30nO474MKb3TbiH2aoru40Vt83Hqi4FPd8e0r6-7MYZ_acggu7n3BLK7tv_cyP8CAAD__1xC7Bw">