4 ms·
Come on, that kind of check is almost trivial to implement. Anyway, there you go: extern int nondet (void); int x = nondet(); if (x < 42) { assert (x !=
by lou1306 3y ago
Come on, that kind of check is almost trivial to implement. Anyway, there you go:
extern int nondet (void);
int x = nondet();
if (x < 42) { assert (x != 12345); }
- kazinator 3y agoThere are trivial cases of the use of an uninitialized variable that elementary data flow analysis will uncover. When the variable definition and its use are together in the same basic block, it's immediately obvious that the variable has a next-use on entry into the block, and that its definition hasn't supplied it with a value. From there it gets complicated. GCC has a history of emitting overly zealous diagnostics in this area, warning about possibly uninitialized variables that can be proven not to be. The difficulty is equivalent to the halting problem: void f() { int x; if (invokes_undefined_behavior(f)) x = 'A'; putchar(x); }