|
| From: | Richard Henderson |
| Subject: | Re: [PATCH 4/4] target/ppc: fix warning with clang-15 |
| Date: | Tue, 14 Feb 2023 08:10:36 -1000 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 |
On 2/13/23 06:13, Pierrick Bouvier wrote:
When compiling for windows-arm64 using clang-15, it reports a sometimes
uninitialized variable. This seems to be a false positive, as a default
case guards switch expressions, preventing to return an uninitialized
value, but clang seems unhappy with assert definition.
Setting the rnd variable to zero does not hurt anyway.
../target/ppc/dfp_helper.c:141:13: error: variable 'rnd' is used uninitialized
whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
assert(0); /*
cannot get here */
^~~~~~~~~
../include/qemu/osdep.h:229:20: note: expanded from macro 'assert'
#define assert(x) g_assert(x)
^~~~~~~~~~~
/clangarm64/bin/../include/glib-2.0/glib/gtestutils.h:235:49: note: expanded
from macro 'g_assert'
if G_LIKELY
(expr) ; else \
^~~~~~~~~~~~~~~
/clangarm64/bin/../include/glib-2.0/glib/gmacros.h:1186:25: note: expanded from
macro 'G_LIKELY'
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../target/ppc/dfp_helper.c:144:42: note: uninitialized use occurs here
decContextSetRounding(&dfp->context, rnd);
I think the problem is with assert(0) not being seen to terminate. Replace these with g_assert_not_reached(). r~
| [Prev in Thread] | Current Thread | [Next in Thread] |