GCC 13 was going to diagnose dlls/webservices/writer.c:960:18: warning: 'mag2' may be used uninitialized
From: Gerald Pfeifer gerald@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 )) {
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.
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.
Sure but wouldn't it be better to wait with such fixes until GCC 13 is released?
GCC 13 has been released two weeks ago and this warning is still there.
Are you good to approve this now, Hans?
This merge request was approved by Hans Leidekker.