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

    <tr>
        <th>Summary</th>
        <td>
            Clang 21 accepts invalid # 0 preprocessor lines leading to undefined behavior at compile time
        </td>
    </tr>

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

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

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

<pre>
    ## Summary

Clang 21 accepts invalid standalone # 0 preprocessor lines in C source files without emitting an error or a warning. When compiled, the program exhibits undefined behavior (e.g., prints unlimited spaces or crashes), despite the code being syntactically invalid.

## Program 

```
uint32_t square(uint32_t x)
# 0
# 0
```

## To reproduce Quickly

https://gcc.godbolt.org/z/c1daT34v6

It gets:

[Truncated]
Compiler returned: 143

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0UtFu2yAU_Rr8clULA07iBz-krSLtbdMq7XHCcGOzYfDgkjb7-slJulbTKiEhoXs4555zdM5uDIg9a-9Z-1jpQlNM_ayTQ8JGCFkN0Z57JiQTEr6WedbpzPie8f2D12EE0YA2BhfK4MJJe2chkw5W-xgQVhCHJeGSosGcYwLvAq6z8AA5lmQQjs5jhmdHUywEODsiF0bQATClmCAm0PCsU3BhrOHbhAFMnBfn0TLxADQhLCmOSc-AL5MbHGUoweLRBbQw4KRPLiZgYof1WK-QJblwGfJudoQW8qIN5pXJJJ0nzEx066DFvDjCC4eJFmHAVVo-B9KGnNHen1_3rq-23Kz6fFN0e9zw2-H74gJJ8Z0g_yo6IRO7vy8vK-3lC-Dv73foN4anCBdfbTEIX4ozP_0tmYloyUzumTgwcRiNqcdoh-ipjmlk4vCbiYNprH6S6rS5Qj4RjEgX0JWjvX9KJRhNaFn7uMZ9tTxBQiopoGVyD42SjO8r20vbyU5X2Ddb1XZqwxWvpl5K2wp7tMKo4443eqeU2mK33XS46Tqzq1wvuGi5El2z5Vy29WbgW6Vku5Wt5IjIFMdZO197f5pX-ZXLuWDfyO1ObSqvB_T50l4hzFpIJsRa5NSvgLuhjJkp7l2m_PYFOfLYf9jfD0vrUds1for_65em11oCuRmrknz_TxKOpjLUJs5MHFY1t-tuSfEHGmLicNkuM3G4LXjqxZ8AAAD__7zmKdU">