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

Bug in the optimizer caused an infinite loop for weird code.
This commit is contained in:
pem@mysql.comhem.se 2005-04-20 15:37:07 +02:00
parent ff665c9513
commit 189d6b502b
3 changed files with 26 additions and 1 deletions

View file

@ -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;

View file

@ -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
#

View file

@ -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)