diff options
author | unknown <thek@adventure.(none)> | 2007-05-07 10:23:10 +0200 |
---|---|---|
committer | unknown <thek@adventure.(none)> | 2007-05-07 10:23:10 +0200 |
commit | 72569cc66d2a1d8edcc3e368213619f7ea855329 (patch) | |
tree | 2bff0cc91cb05a081ba21c79a104862facc39de5 /sql/sp_head.cc | |
parent | c49e378ac4a690220d86c11ef40f2382848c6d30 (diff) | |
download | mariadb-git-72569cc66d2a1d8edcc3e368213619f7ea855329.tar.gz |
Bug#26977 exception handlers never hreturn
- In some cases, flow control optimization implemented in sp::optimize
removes hreturn instructions, causing SQL exception handlers to:
* never return
* execute wrong logic
- This patch overrides default short cut optimization on hreturn instructions
to avoid this problem.
mysql-test/r/sp-code.result:
Added test case
mysql-test/t/sp-code.test:
Added test case
sql/sp_head.cc:
Override opt_mark to get correct execution paths without jump short cut
optimization.
sql/sp_head.h:
Added override sp_instr_hreturn::opt_shortcut_jump so that jump short cuts aren't
performed on hreturn instructions operating on handlers which are set to CONTINUE
after interruption.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r-- | sql/sp_head.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 1ebef4f8bee..5a1faf50296 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -2982,10 +2982,20 @@ sp_instr_hreturn::print(String *str) uint sp_instr_hreturn::opt_mark(sp_head *sp, List<sp_instr> *leads) { - if (m_dest) - return sp_instr_jump::opt_mark(sp, leads); - marked= 1; + + if (m_dest) + { + /* + This is an EXIT handler; next instruction step is in m_dest. + */ + return m_dest; + } + + /* + This is a CONTINUE handler; next instruction step will come from + the handler stack and not from opt_mark. + */ return UINT_MAX; } |