http://bugs.winehq.org/show_bug.cgi?id=15388
Summary: gdi32: dib.c fails to build with gcc 4.2, -Werror -O3 Product: Wine Version: 1.1.5 Platform: PC OS/Version: Linux Status: NEW Keywords: source Severity: enhancement Priority: P2 Component: gdi32 AssignedTo: wine-bugs@winehq.org ReportedBy: austinenglish@gmail.com
ccache /usr/bin/gcc-4.2 -O3 -c -I. -I. -I../../include -I../../include -I/usr/include/freetype2 -D__WINESRC__ -D_GDI32_ -D_REENTRANT -fPIC -Wall -pipe -fno-strength-reduce -fno-strict-aliasing -Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith -Werror -o dib.o dib.c cc1: warnings being treated as errors dib.c: In function ‘CreateDIBSection16’: dib.c:1162: warning: ‘size’ may be used uninitialized in this function dib.c:1162: warning: ‘compr’ may be used uninitialized in this function dib.c:1161: warning: ‘bpp’ may be used uninitialized in this function dib.c:1160: warning: ‘height’ may be used uninitialized in this function dib.c:1160: warning: ‘width’ may be used uninitialized in this function make: *** [dib.o] Error 1
http://bugs.winehq.org/show_bug.cgi?id=15388
--- Comment #1 from Austin English austinenglish@gmail.com 2008-09-24 14:13:47 --- Created an attachment (id=16257) --> (http://bugs.winehq.org/attachment.cgi?id=16257) patch to initialize the variables
Haven't submitted yet, comments appreciated.
http://bugs.winehq.org/show_bug.cgi?id=15388
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |bunglehead@gmail.com
--- Comment #2 from Nikolay Sivov bunglehead@gmail.com 2008-09-25 04:02:45 --- I think it's better to check return value for DIB_GetBitmapInfo and exit on -1. Since DIB_GetBitmapInfo is internal function which always fills this variables on success. So with properly initialized header there shouldn't be any problem.
http://bugs.winehq.org/show_bug.cgi?id=15388
Andrey Turkin andrey.turkin@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |andrey.turkin@gmail.com
--- Comment #3 from Andrey Turkin andrey.turkin@gmail.com 2008-09-25 04:14:37 --- The compiler wisely warn us that DIB_GetBitmapInfo would not always fill the variables. I'd follow way it is done in CreateDIBitmap (get info early, before any other operations, and bail out if DIB_GetBitmapInfo fails)
http://bugs.winehq.org/show_bug.cgi?id=15388
--- Comment #4 from Nikolay Sivov bunglehead@gmail.com 2008-09-25 04:27:39 --- (In reply to comment #3)
I'd follow way it is done in CreateDIBitmap (get info early, before any other operations, and bail out if DIB_GetBitmapInfo fails)
Exactly, that's what I meant.
http://bugs.winehq.org/show_bug.cgi?id=15388
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #16257|0 |1 is obsolete| |
--- Comment #5 from Austin English austinenglish@gmail.com 2008-09-29 21:16:59 --- Created an attachment (id=16377) --> (http://bugs.winehq.org/attachment.cgi?id=16377) new patch
This what you had in mind?
http://bugs.winehq.org/show_bug.cgi?id=15388
--- Comment #6 from Nikolay Sivov bunglehead@gmail.com 2008-09-29 23:11:38 --- (In reply to comment #5)
Created an attachment (id=16377)
--> (http://bugs.winehq.org/attachment.cgi?id=16377) [details]
new patch
This what you had in mind?
Yes, but why are you duplicating a call? You could just use a result of existing one:
DIB_GetBitmapInfo(bi, &width, &height, &planes, &bpp, &compr, &size);
+ if (DIB_GetBitmapInfo( bi, &width, &height, &planes, &bpp, &compr, &size ) == -1) return 0;
http://bugs.winehq.org/show_bug.cgi?id=15388
--- Comment #7 from Andrey Turkin andrey.turkin@gmail.com 2008-09-30 01:17:02 --- Uhm... After re-reading sources this error actually looks like false positive as we already know DIB_GetBitmapInfo will work if we get to its call (because of succeed CreateDIBSection). Probably too complicated for compiler's little brain :) However, in any other case this patch would be wrong because of introduced resource leaks (DIB section was already created). I can see two ways - either silence compiler like your original patch did, or pretend this is not false positive and move DIB_GetBitmapInfo call up to very function beginning.
http://bugs.winehq.org/show_bug.cgi?id=15388
--- Comment #8 from Austin English austinenglish@gmail.com 2008-12-08 03:47:41 --- Still present in 1.1.10.
http://bugs.winehq.org/show_bug.cgi?id=15388
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |nerv@dawncrow.de Resolution| |FIXED
--- Comment #9 from André H. nerv@dawncrow.de 2010-01-20 06:56:44 --- cannot confirm this, seems fixed Wine-1.1.36
http://bugs.winehq.org/show_bug.cgi?id=15388
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #10 from Alexandre Julliard julliard@winehq.org 2010-01-22 11:01:51 --- Closing bugs fixed in 1.1.37.