Skip to content

Commit

Permalink
fix gcc optimized build
Browse files Browse the repository at this point in the history
../sql/spatial.cc: In member function ‘double Gis_point::calculate_haversine(const Geometry*, double, int*)’:
../sql/spatial.cc:1093:45: error: ‘y1r’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1093 |   res= 2*sphere_radius*asin((sqrt(dlat + cos(y1r)*cos(y2r)*dlong)));
      |                                          ~~~^~~~~
../sql/spatial.cc:1092:20: error: ‘x1r’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1092 |   dlong=  sin((x2r - x1r)/2)*sin((x2r - x1r)/2);
      |               ~~~~~^~~~~~
../sql/spatial.cc:1093:54: error: ‘y2r’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1093 |   res= 2*sphere_radius*asin((sqrt(dlat + cos(y1r)*cos(y2r)*dlong)));
      |                                                   ~~~^~~~~
../sql/spatial.cc:1092:20: error: ‘x2r’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1092 |   dlong=  sin((x2r - x1r)/2)*sin((x2r - x1r)/2);
      |               ~~~~~^~~~~~
c
  • Loading branch information
kevgs committed Apr 1, 2021
1 parent 77ffbbc commit 4c80dcd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sql/spatial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ double Gis_point::calculate_haversine(const Geometry *g,
int *error)
{
DBUG_ASSERT(sphere_radius > 0);
double x1r, x2r, y1r, y2r, dlong, dlat, res;
double x1r= 0.0, x2r= 0.0, y1r= 0.0, y2r= 0.0, dlong, dlat, res;

// This check is done only for optimization purposes where we know it will
// be one and only one point in Multipoint
Expand Down

0 comments on commit 4c80dcd

Please sign in to comment.