Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

‘defaultValue’ may be used uninitialized in this function #12870

Closed
danzel opened this issue Sep 12, 2018 · 3 comments
Closed

‘defaultValue’ may be used uninitialized in this function #12870

danzel opened this issue Sep 12, 2018 · 3 comments
Labels
Qt Mapbox Maps SDK for Qt, aka Qt Location Mapbox GL

Comments

@danzel
Copy link

danzel commented Sep 12, 2018

Platform: Debian Stretch (QT)

Steps to trigger behavior

Trying to build BUILDTYPE=Release make qt-app fails with the following error

[199/374] Building CXX object CMakeFiles/mbgl-core.dir/src/mbgl/style/conversion/function.cpp.o
FAILED: CMakeFiles/mbgl-core.dir/src/mbgl/style/conversion/function.cpp.o
/usr/bin/c++   -DMBGL_USE_GLES2 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DRAPIDJSON_HAS_STDSTRING=1 -D_GLIBCXX_USE_CXX11_ABI=1 -D__QT__ -I../../../include -I../../../src -I../../../mason_packages/headers/geometry/0.9.3/include -I../../../mason_packages/headers/variant/1.1.4/include -I../../../mason_packages/headers/unique_resource/cba309e/include -I../../../mason_packages/headers/rapidjson/1.1.0/include -I../../../mason_packages/headers/boost/1.65.1/include -I../../../mason_packages/headers/geojson/0.4.2/include -I../../../mason_packages/headers/geojsonvt/6.6.0/include -I../../../mason_packages/headers/supercluster/0.2.2/include -I../../../mason_packages/headers/kdbush/0.1.1-1/include -I../../../mason_packages/headers/earcut/0.12.4/include -I../../../mason_packages/headers/protozero/1.5.2/include -I../../../mason_packages/headers/polylabel/1.0.3/include -I../../../mason_packages/headers/wagyu/0.4.3/include -I../../../mason_packages/headers/shelf-pack/2.1.1/include -I../../../mason_packages/headers/vector-tile/1.0.2/include -I../../../platform/default -I../../../platform/qt -I../../../platform/qt/include -I../../../mason_packages/linux-x86_64/libjpeg-turbo/1.5.0/include -I../../../mason_packages/linux-x86_64/libpng/1.6.25/include/libpng16 -I../../../mason_packages/linux-x86_64/webp/0.5.1/include -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -I../../../vendor/nunicode/include -I../../../vendor/icu/include -ftemplate-depth=1024 -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wno-variadic-macros -Wno-unknown-pragmas -Werror -fext-numeric-literals -O3 -DNDEBUG -Os -DNDEBUG -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -fPIC -std=c++14 -MD -MT CMakeFiles/mbgl-core.dir/src/mbgl/style/conversion/function.cpp.o -MF CMakeFiles/mbgl-core.dir/src/mbgl/style/conversion/function.cpp.o.d -o CMakeFiles/mbgl-core.dir/src/mbgl/style/conversion/function.cpp.o -c /usr/src/app/mapbox-gl-native/src/mbgl/style/conversion/function.cpp
In function ‘mbgl::optional<mbgl::style::PropertyExpression<T> > mbgl::style::conversion::convertFunctionToExpression(const mbgl::style::conversion::Convertible&, mbgl::style::conversion::Error&, bool) [with T = mbgl::style::AlignmentType]’:
cc1plus: error: ‘defaultValue’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
/usr/src/app/mapbox-gl-native/src/mbgl/style/conversion/function.cpp:82:17: note: ‘defaultValue’ was declared here
     optional<T> defaultValue;
                 ^~~~~~~~~~~~

Bigger snippet of the build logs https://gist.github.com/danzel/e1e7fea51ab6ba6b30e7c6df5eb6ee8d

Attempting to build with latest git (e947fa0) fails.
Building with 9df9f5f succeeds. (Chosen as it is the parent of the commit that I believe broke this)

The code the error is coming from was moved around in #12665 by @kkaefer, it does sorta look like it may be using the variable without assigning it.
https://github.com/mapbox/mapbox-gl-native/blob/master/src/mbgl/style/conversion/function.cpp#L75-L94

Otherwise maybe could be g++ version, circleci seems to build with 5.4.0, which is older than 6.3.0 that I am using.

g++ --version
g++ (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
@tobrun tobrun added the Qt Mapbox Maps SDK for Qt, aka Qt Location Mapbox GL label Sep 13, 2018
@brunoabinader
Copy link
Member

Hi @danzel - apologies for the delay - is this still an issue?

@pozdnyakov
Copy link
Contributor

Fixed with bf785f5

@danzel
Copy link
Author

danzel commented Nov 3, 2018

Cool thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Qt Mapbox Maps SDK for Qt, aka Qt Location Mapbox GL
Projects
None yet
Development

No branches or pull requests

4 participants