diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-02-12 14:36:52 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-02-12 14:36:52 -0500 |
commit | 4ddbaf8a44e4bf46d3ebe3c5afc957ecd07cfa0a (patch) | |
tree | 0a7931c79ea13b9032a8e4958f88024b084feacc /src/sanity.h | |
parent | a98fe72db88350fcec030487208e6c50c9de1974 (diff) | |
download | bfs-4ddbaf8a44e4bf46d3ebe3c5afc957ecd07cfa0a.tar.xz |
sanity: Don't use self-init for uninit()
Self-initialization like
bool ret = ret;
is a GCC trick to suppress uninitialized variable warnings, but it's not
actually well-defined, and will trip a recent enough MemorySanitizer:
src/eval.c:1088:13: runtime error: load of value 128, which is not a valid value for type 'bool'
Diffstat (limited to 'src/sanity.h')
-rw-r--r-- | src/sanity.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sanity.h b/src/sanity.h index 29b3519..423e6ff 100644 --- a/src/sanity.h +++ b/src/sanity.h @@ -86,9 +86,9 @@ * Initialize a variable, unless sanitizers would detect uninitialized uses. */ #if SANITIZE_MEMORY -# define uninit(var, value) var +# define uninit(value) #else -# define uninit(var, value) value +# define uninit(value) = value #endif #endif // BFS_SANITY_H |