Commit 5642bbd3 authored by unknown's avatar unknown

Fixed BUG#6898: Stored procedure crash if GOTO statements exist

  Bug in the optimizer caused an infinite loop for weird code.


mysql-test/r/sp.result:
  New test case for BUG#6898.
mysql-test/t/sp.test:
  New test case for BUG#6898.
sql/sp_head.cc:
  Detect self referencing jumps in the optimizer.
parent 58ffacc4
......@@ -2958,4 +2958,13 @@ select @x|
set global query_cache_size = @qcs1|
delete from t1|
drop function bug9902|
drop procedure if exists bug6898|
create procedure bug6898()
begin
goto label1;
label label1;
begin end;
goto label1;
end|
drop procedure bug6898|
drop table t1,t2;
......@@ -3628,6 +3628,22 @@ delete from t1|
drop function bug9902|
#
# BUG#6898: Stored procedure crash if GOTO statements exist
#
--disable_warnings
drop procedure if exists bug6898|
--enable_warnings
create procedure bug6898()
begin
goto label1;
label label1;
begin end;
goto label1;
end|
drop procedure bug6898|
#
# BUG#NNNN: New bug synopsis
#
......
......@@ -1499,7 +1499,7 @@ sp_instr_jump::opt_shortcut_jump(sp_head *sp, sp_instr *start)
{
uint ndest;
if (start == i)
if (start == i || this == i)
break;
ndest= i->opt_shortcut_jump(sp, start);
if (ndest == dest)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment