[PATCH 0/1] MR2230: webservices: Avoid uninitialized variable warning in format_double
GCC 13 was going to diagnose dlls/webservices/writer.c:960:18: warning: 'mag2' may be used uninitialized -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2230
From: Gerald Pfeifer <gerald(a)pfeifer.com> GCC 13 was going to diagnose dlls/webservices/writer.c:960:18: warning: 'mag2' may be used uninitialized --- dlls/webservices/writer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c index a4cfc94f08e..6923035f00c 100644 --- a/dlls/webservices/writer.c +++ b/dlls/webservices/writer.c @@ -896,7 +896,7 @@ static ULONG format_double( const double *ptr, unsigned char *buf ) static const double precision = 0.0000000000000001; unsigned char *p = buf; double val = *ptr; - int neg, mag, mag2, use_exp; + int neg, mag, mag2 = 0, use_exp; if (isnan( val )) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2230
It's a false positive. GCC doesn't see that mag2 is only used when use_exp evaluates to true, in which case it has been set earlier. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2230#note_24751
We generally do silence warnings like this (by initializing the variable), So that's what I did here, too. Luckily it's about the only one left. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2230#note_24754
Sure but wouldn't it be better to wait with such fixes until GCC 13 is released? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2230#note_24755
GCC 13 has been released two weeks ago and this warning is still there. Are you good to approve this now, Hans? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2230#note_32256
This merge request was approved by Hans Leidekker. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2230
participants (3)
-
Gerald Pfeifer -
Gerald Pfeifer (@gerald) -
Hans Leidekker (@hans)