RESOLVED FIXED 115648
Build with GCC 4.8 fails because of -Wmaybe-uninitialized
https://bugs.webkit.org/show_bug.cgi?id=115648
Summary Build with GCC 4.8 fails because of -Wmaybe-uninitialized
Andras Becsi
Reported 2013-05-06 08:42:43 PDT
Build with GCC 4.8 fails because of -Wmaybe-uninitialized
Attachments
Patch (1.89 KB, patch)
2013-05-06 08:43 PDT, Andras Becsi
no flags
Patch (1.54 KB, patch)
2013-05-06 11:44 PDT, Andras Becsi
no flags
Andras Becsi
Comment 1 2013-05-06 08:43:19 PDT
Mark Hahnenberg
Comment 2 2013-05-06 09:04:42 PDT
Comment on attachment 200703 [details] Patch Hmm, maybe there's a way to make it so OptionRange has a trivial constructor and then we can manually initialize the fields with an init method? I'm leery of disabling warnings.
Michael Saboff
Comment 3 2013-05-06 10:59:22 PDT
I had a trivial constructor but got these messages from clang: /Volumes/Data/src/webkit.work/Source/JavaScriptCore/runtime/Options.cpp:166:25: error: call to deleted constructor of 'Options::Entry [57]' Options::Entry Options::s_options[Options::numberOfOptions]; ^ In file included from /Volumes/Data/src/webkit.work/Source/JavaScriptCore/runtime/Options.cpp:27: /Volumes/Data/src/webkit.work/Source/JavaScriptCore/runtime/Options.h:222:12: note: function has been explicitly marked deleted here struct Entry { ^ 1 error generated. Here is the constructor: OptionRange() : m_state(Uninitialized) , m_rangeString(0) , m_lowLimit(0) , m_highLimit(0) { } What line is it complaining may be uninitialized?
Andras Becsi
Comment 4 2013-05-06 11:44:24 PDT
Andras Becsi
Comment 5 2013-05-06 11:44:43 PDT
(In reply to comment #3) > I had a trivial constructor but got these messages from clang: > > /Volumes/Data/src/webkit.work/Source/JavaScriptCore/runtime/Options.cpp:166:25: error: call to deleted constructor of 'Options::Entry [57]' > Options::Entry Options::s_options[Options::numberOfOptions]; > ^ > In file included from /Volumes/Data/src/webkit.work/Source/JavaScriptCore/runtime/Options.cpp:27: > /Volumes/Data/src/webkit.work/Source/JavaScriptCore/runtime/Options.h:222:12: note: function has been explicitly marked deleted here > struct Entry { > ^ > 1 error generated. > > Here is the constructor: > OptionRange() > : m_state(Uninitialized) > , m_rangeString(0) > , m_lowLimit(0) > , m_highLimit(0) > { > } The problem with this is that a constructor with an initializer-list is not trivial any more and hence can not be placed into a union,which can only hold POD. With "trivial constructor" I actually meant "default constructor with no initializer list and empty body" (equivalent with an implicitly-declared constructor generated by the compiler). GCC has an informative error message with the above constructor: error: member 'JSC::OptionRange JSC::Options::Entry::<anonymous union>::optionRangeVal' with constructor not allowed in union note: unrestricted unions only available with -std=c++11 or -std=gnu++11 > > What line is it complaining may be uninitialized? /home/abecsi/devel/git/webkit-git-svn/Source/JavaScriptCore/runtime/Options.cpp:120:17: error: 'value.JSC::OptionRange::m_state' may be used uninitialized in this function [-Werror=maybe-uninitialized] This is actually valid, since in Options::setOption the values are not initialized, hence the new patch.
Andras Becsi
Comment 6 2013-05-06 11:48:23 PDT
Comment on attachment 200731 [details] Patch Clearing flags on attachment: 200731 Committed r149622: <http://trac.webkit.org/changeset/149622>
Andras Becsi
Comment 7 2013-05-06 11:48:28 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.