Bug #90912 gcc 4.7.2 warning in sql/geometry_rtree.cc: 'box' may be used uninitialized
Submitted: 17 May 2018 10:42 Modified: 21 May 2018 4:35
Reporter: Przemysław Skibiński (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.7.22 OS:Debian (Wheezy)
Assigned to: CPU Architecture:x86

[17 May 2018 10:42] Przemysław Skibiński
Description:
The newest version of gcc for Debian wheezy that is gcc 4.7.2 (couldn't reproduce it with Ubuntu 16.04 and gcc 4.7.4) returns:

In file included from /tmp/ps/sql/geometry_rtree.cc:16:0:
/tmp/ps/sql/item_geofunc_internal.h: In static member function 'static boost::geometry::index::detail::rtree::pack<Value, Options, Translator, Box, Allocators>::node_pointer boost::geometry::index::detail::rtree::pack<Value, Options, Translator, Box, Allocators>::apply(InIt, InIt, boost::geometry::index::detail::rtree::pack<Value, Options, Translator, Box, Allocators>::size_type&, boost::geometry::index::detail::rtree::pack<Value, Options, Translator, Box, Allocators>::size_type&, const parameters_type&, const Translator&, Allocators&) [with InIt = boost::iterators::filter_iterator<Is_rtree_box_valid, boost::iterators::transform_iterator<Rtree_value_maker_bggeom, boost::range_detail::indexed_iterator<Gis_wkb_vector_const_iterator<Gis_polygon> >, boost::iterators::use_default, boost::iterators::use_default> >; Value = std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, long unsigned int>; Options = boost::geometry::index::detail::rtree::options<boost::geometry::index::quadratic<64ul>, boost::geometry::index::detail::rtree::insert_default_tag, boost::geometry::index::detail::rtree::choose_by_content_diff_tag, boost::geometry::index::detail::rtree::split_default_tag, boost::geometry::index::detail::rtree::quadratic_tag, boost::geometry::index::detail::rtree::node_variant_static_tag>; Translator = boost::geometry::index::detail::translator<boost::geometry::index::indexable<std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, long unsigned int> >, boost::geometry::index::equal_to<std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, long unsigned int> > >; Box = boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >; Allocators = boost::geometry::index::detail::rtree::allocators<std::allocator<std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, long unsigned int> >, std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, long unsigned int>, boost::geometry::index::quadratic<64ul>, boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, boost::geometry::index::detail::rtree::node_variant_static_tag>; boost::geometry::index::detail::rtree::pack<Value, Options, Translator, Box, Allocators>::node_pointer = boost::variant<boost::geometry::index::detail::rtree::variant_leaf<std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, long unsigned int>, boost::geometry::index::quadratic<64ul>, boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, boost::geometry::index::detail::rtree::allocators<std::allocator<std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, long unsigned int> >, std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, long unsigned int>, boost::geometry::index::quadratic<64ul>, boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, boost::geometry::index::detail::rtree::node_variant_static_tag>, boost::geometry::index::detail::rtree::node_variant_static_tag>, boost::geometry::index::detail::rtree::variant_internal_node<std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, long unsigned int>, boost::geometry::index::quadratic<64ul>, boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, boost::geometry::index::detail::rtree::allocators<std::allocator<std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, long unsigned int> >, std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, long unsigned int>, boost::geometry::index::quadratic<64ul>, boost::geometry::model::box<boost::geometry::model::point<double, 2ul, boost::geometry::cs::cartesian> >, boost::geometry::index::detail::rtree::node_variant_static_tag>, boost::geometry::index::detail::rtree::node_variant_static_tag>, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_>*; boost::geometry::index::detail::rtree::pack<Value, Options, Translator, Box, Allocators>::size_type = long unsigned int; boost::geometry::index::detail::rtree::pack<Value, Options, Translator, Box, Allocators>::parameters_type = boost::geometry::index::quadratic<64ul>]':
/tmp/ps/sql/item_geofunc_internal.h:163:60: error: '*((void*)& box +24)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/tmp/ps/sql/geometry_rtree.cc:69:12: note: '*((void*)& box +24)' was declared here
/tmp/ps/sql/geometry_rtree.cc:69:12: error: '*((void*)& box +8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
In file included from /tmp/ps/sql/geometry_rtree.cc:16:0:
/tmp/ps/sql/item_geofunc_internal.h:163:60: error: '*((void*)& box +16)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/tmp/ps/sql/geometry_rtree.cc:69:12: note: '*((void*)& box +16)' was declared here
In file included from /tmp/ps/sql/geometry_rtree.cc:16:0:
/tmp/ps/sql/item_geofunc_internal.h:163:60: error: 'box' may be used uninitialized in this function [-Werror=maybe-uninitialized]
/tmp/ps/sql/geometry_rtree.cc:69:12: note: 'box' was declared here
cc1plus: all warnings being treated as errors
[ 46%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/fts/fts0tlex.cc.o
make[2]: *** [libmysqld/CMakeFiles/sql_embedded.dir/__/sql/geometry_rtree.cc.o] Error 1

How to repeat:
cmake -DMAINTAINER_MODE=ON

Suggested fix:
@@ -66,9 +66,7 @@ struct Rtree_value_maker_bggeom
   template<typename  T>
   result_type operator()(T const &v) const
   {
-    BG_box box;
-    boost::geometry::envelope(v.value(), box);
-
+    BG_box box = boost::geometry::return_envelope<BG_box>(v.value());
     return result_type(box, v.index());
   }
 };
[18 May 2018 13:22] MySQL Verification Team
Hello Przemysław,

Thank you for the report.
I'm not seeing the reported issue on exact environment. Shortly joining build details for your reference. Could you please confirm exact cmake options used? Thank you.

Regards,
Umesh
[18 May 2018 13:22] MySQL Verification Team
Build details

Attachment: 90912_Debian7.build (application/octet-stream, text), 222.34 KiB.

[18 May 2018 14:23] Przemysław Skibiński
Hi Umesh,

After cleaning and rebuilding the project I am not able to reproduce the issue. Please close this bug report. I apologize for taking time unnecessarily.

Przemyslaw
[21 May 2018 4:35] MySQL Verification Team
Hello Przemyslaw,

Thank you for confirming, as suggested closing it for now.

Regards,
Umesh