<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/72481>72481</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] why is clang not support -Wmaybe-uninitialized
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
CoTinker
</td>
</tr>
</table>
<pre>
demo.c:
```
#include <stdio.h>
void foo (int a) {
printf("%d\n",a);
}
int main() {
int x;
int y;
scanf("%d",&y);
switch (y)
{
case 1: x = 1;
break;
case 2: x = 4;
break;
case 3: x = 5;
}
foo (x);
}
```
compile command
`gcc demo.c -o demo -O1 -Wall`
report warning:
```
demo.c: In function 'main':
demo.c:17:3: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
foo (x);
^~~~~~~
```
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmaybe-uninitialized
but clang not support this warning.
I wonder why the llvm community does not support this alarm and whether it will be supported in the future.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VE2PozgQ_TXmUgKBHT5y4DCdTKQ5zWWlPhu7AG8bO8Kmk-xhf_vKJp2P3miiCGzqVb2q9wzcOTUYxJaUb6TcJ3zxo53bnf1LmQ-ck87KSytxspkg7AfJ9yT_ulb59b9uKVNG6EUiELZzXiqbjYT9XKOfVknorQVCG2U8cEK3QOq3NQoAx1kZ3xPaEEoJLSUpdyYudwFK2BVJ6v26CEUmrkzMeCoVIudbwrq_POyd4OaRKJIQWl0eeQDcSXkxhn5j4KvPBybBHUJB2A84A2H7sLzPAwDdjPzj6VnMoPeMzZ8zIpzd4eUT_CYFfAl7fqnUN5-EnY5KIwg7TdzIb44OQsDqNqQ2riD9XUD6zrW-Wx2vMx7t7OHEZ6PMcD8cz3S3owO_DPSLEV5ZA4TWq3n1Le8GLMKzOPW9dEg4E1rDxC_QISwOJSxGGeUV1-oflKAM-FG5B47yLX2f-KXD9AlJyptuL4UDUv78N_5eDjR6f3Sha3og9DAIkQ1myew8EHqwRiuD0gq3hgg9vK8zpL-PoSmXjX7S8VWReH7dXmTpFg9CczOAsR7ccoxaxwGvqmQr8BecrJE4w2m8gB8RtP6cormLUf4C0qL7fw2u-TwBNxJOI_oRZ1AeTkrrIO4ViRJWURH6xS8zZo_uJ7Jlcsu2PMG2qPO8KKqSFcnYyrIUG1lURVM3zXbb8zqvGuSSVpL1Fe0T1dKcsqIoqrxiJSsyVm6avpG0x6rhvBJkk-PElc7CKEHZRDm3YFvTTVMkmneoXfxcURolCm9wuU_mNuDTbhkc2eRaOe_uFbzyOn7j1oxyH_VS7oXIL11Jllm336xXfly6TNiJ0EMgut7S42z_RuEJPcS-w1mIrf8XAAD__0mhlLg">