https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122183
Bug ID: 122183
Summary: Missing -Wmaybe-uninitialized
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: false-positive
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: sjames at gcc dot gnu.org
Blocks: 24639
Target Milestone: ---
There's a maybe missed-optimisation with a bug I hit a while ago that I keep
thinking about occasionally.
Playing around with it to try get a testcase, a variant gives me this:
```
enum
{
JSON_TYPE_NULL,
JSON_TYPE_TEXT
} type;
char *data_val;
void
test_json_istream_read_string ()
{
long size_val;
type = JSON_TYPE_TEXT;
switch (type)
{
case JSON_TYPE_TEXT:
break;
case JSON_TYPE_NULL:
size_val = 0;
break;
}
if (size_val > 20 || size_val < 0)
__builtin_abort ();
}
int
main ()
{
test_json_istream_read_string ();
}
```
We don't seem to ever emit -Wmaybe-uninitialized for this.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues