summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-08-31 16:48:28 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-09-01 15:53:47 +0300
commit4a165f37114eafc0cced25dfea80b3f3bccc2fbf (patch)
treeb38df9bbd06feec5d55269ae6d016e92a9dc56d2 /sql/opt_range.cc
parent97db6c15ea3e83a21df137c222dbd5a40fbe7c82 (diff)
downloadmariadb-git-4a165f37114eafc0cced25dfea80b3f3bccc2fbf.tar.gz
Fix GCC 10.2.0 -Og -Wmaybe-uninitialized
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 6a5f1c9f750..e933d2af355 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -7555,13 +7555,15 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
table_map param_comp= ~(param->prev_tables | param->read_tables |
param->current_table);
#ifdef HAVE_SPATIAL
- Field::geometry_type sav_geom_type;
- const bool geometry= field_item->field->type() == MYSQL_TYPE_GEOMETRY;
- if (geometry)
+ Field::geometry_type sav_geom_type= Field::GEOM_GEOMETRY, *geom_type=
+ field_item->field->type() == MYSQL_TYPE_GEOMETRY
+ ? &(static_cast<Field_geom*>(field_item->field))->geom_type
+ : NULL;
+ if (geom_type)
{
- sav_geom_type= ((Field_geom*) field_item->field)->geom_type;
+ sav_geom_type= *geom_type;
/* We have to be able to store all sorts of spatial features here */
- ((Field_geom*) field_item->field)->geom_type= Field::GEOM_GEOMETRY;
+ *geom_type= Field::GEOM_GEOMETRY;
}
#endif /*HAVE_SPATIAL*/
@@ -7592,9 +7594,9 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
}
#ifdef HAVE_SPATIAL
- if (geometry)
+ if (geom_type)
{
- ((Field_geom*) field_item->field)->geom_type= sav_geom_type;
+ *geom_type= sav_geom_type;
}
#endif /*HAVE_SPATIAL*/
DBUG_RETURN(ftree);