https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115089
--- Comment #2 from Alejandro Colomar <alx at kernel dot org> --- I found that Clang's analyzer finds this bug, so I'm less concerned that GCC can't find it. Feel free to ignore it if it's too hard to fix. ;) $ clang-tidy ./bug.c Error while trying to load a compilation database: Could not auto-detect compilation database for file "./bug.c" No compilation database found in /home/alx/tmp/analyzer or any parent directory fixed-compilation-database: Error while opening fixed database: No such file or directory json-compilation-database: Error while opening JSON database: No such file or directory Running without flags. 1 warning generated. /home/alx/tmp/analyzer/bug.c:16:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn] return x; // maybe uninitialized use ^ ~ /home/alx/tmp/analyzer/bug.c:13:2: note: 'x' declared without an initial value int x; ^~~~~ /home/alx/tmp/analyzer/bug.c:15:2: note: Calling 'g' g(&x); ^~~~~ /home/alx/tmp/analyzer/bug.c:6:6: note: Assuming the condition is false if (arc4random() % 2) ^~~~~~~~~~~~~~~~ /home/alx/tmp/analyzer/bug.c:6:2: note: Taking false branch if (arc4random() % 2) ^ /home/alx/tmp/analyzer/bug.c:8:1: note: Returning without writing to '*x' } ^ /home/alx/tmp/analyzer/bug.c:15:2: note: Returning from 'g' g(&x); ^~~~~ /home/alx/tmp/analyzer/bug.c:16:2: note: Undefined or garbage value returned to caller return x; // maybe uninitialized use ^ ~