From fb47a163d48e8364bf61a99246ff5e79bc46836e Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sat, 12 Feb 2011 17:17:19 +0100 Subject: [PATCH] Fix MYSQL Bug#60057 : sel_arg_range_seq_next loops in optimized compilation/VS2010 When mariadb 5.3 is compiler with VS2010, several tests would enter infinite loop in sel_arg_range_seq_next(). The reason is compiler backend bug. This bug is not present in either VS2008 or VS2010 SP1 RC. Workaround is to compile this function without most aggresive optimization flag (-Og ) using #pragma optimize ("g", {on|off}) for this version of MSVC compiler. --- sql/opt_range_mrr.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sql/opt_range_mrr.cc b/sql/opt_range_mrr.cc index e5da9577f7f..2047f6f250c 100644 --- a/sql/opt_range_mrr.cc +++ b/sql/opt_range_mrr.cc @@ -120,6 +120,14 @@ static void step_down_to(SEL_ARG_RANGE_SEQ *arg, SEL_ARG *key_tree) TRUE No more ranges in the sequence */ +#if (_MSC_FULL_VER == 160030319) +/* + Workaround Visual Studio 2010 RTM compiler backend bug, the function enters + infinite loop. + */ +#pragma optimize("g", off) +#endif + bool sel_arg_range_seq_next(range_seq_t rseq, KEY_MULTI_RANGE *range) { SEL_ARG *key_tree; @@ -273,6 +281,12 @@ walk_up_n_right: return 0; } +#if (_MSC_FULL_VER == 160030319) +/* VS2010 compiler bug workaround */ +#pragma optimize("g", on) +#endif + + /**************************************************************************** MRR Range Sequence Interface implementation that walks array ****************************************************************************/