diff options
author | Akihiko Odaki <akihiko.odaki@daynix.com> | 2023-04-05 16:00:30 +0900 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-04-20 11:17:35 +0200 |
commit | 8041e9e314819de9f54f3e267a0479e329561b96 (patch) | |
tree | 16a5602ed742d7ceabcc0a04a4ba45cabb25e551 /util | |
parent | a74b0d0a6dcca4e7d7561655256a8cf671d80ac1 (diff) | |
download | qemu-8041e9e314819de9f54f3e267a0479e329561b96.zip qemu-8041e9e314819de9f54f3e267a0479e329561b96.tar.gz qemu-8041e9e314819de9f54f3e267a0479e329561b96.tar.bz2 |
configure: Avoid -Werror=maybe-uninitialized
The configure script used to compile some code which dereferences memory
with ubsan to verify the compiler can link with ubsan library which
detects dereferencing of uninitialized memory. However, as the
dereferenced memory was allocated in the same code, GCC can statically
detect the unitialized memory dereference and emit maybe-uninitialized
warning. If -Werror is set, this becomes an error, and the configure
script incorrectly thinks the error indicates the compiler cannot use
ubsan.
Fix this error by replacing the code with another function which adds
1 to a signed integer argument. This brings in ubsan to detect if it
causes signed integer overflow. As the value of the argument cannot be
statically determined, the new function is also immune to compiler
warnings.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230405070030.23148-1-akihiko.odaki@daynix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util')
0 files changed, 0 insertions, 0 deletions