<HTML>
<div><style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style>Hi everyone,</div><div><br>
</div><div>So I've been taking a look at the issue listed in bug ticket #32913, where a try...finally block inside the except part of a try...except block either produces bad assembly language or raises Internal Error 200309201.  So far, I'm still trying to understand the control flow of the compiler and how the individual blocks are put together.</div><div><br>
</div><div>What I've found so far, using the following code example:<br>
<br>
program undefined_symbol_bug;<br>
<br>
uses SysUtils;<br>
<br>
procedure p;<br>
   begin<br>
      try<br>
        {a}<br>
      except<br>
        on e: Exception do<br>
          try<br>
            {b}<br>
          finally<br>
            {c}<br>
          end;<br>
      end;<br>
   end;<br>
<br>
begin<br>
  p;<br>
end.<br>
<br>
{a}, {b} and {c} are replaced with simple WriteLn or Exit commands, or left blank.<br>
<br>
- If {a} is empty and {b} is not empty, then Internal Error 200309201 is raised. Value of {c} doesn't matter, and the error doesn't happen if the 'try...finally' block is removed. Error still occurs if the "on e: Exception do" line is removed.<br>
- If {a} is not empty, then the program normally compiles whether or not {b} or {c} is empty, except in one circumstance...<br>
- If {b} contains "Exit", then the assembly produced is missing a label and fails to link.<br>
<br>
So the presence of "Exit" in {b} causes bad code generation, while an internal error occurs if {a} is empty, but {b} isn't.  I'm still investigating and wish to fix these problems, but if anyone is able to offer any insight if not stumble upon the solution yourself, I'll be most grateful.<br>
<br>
Gareth aka. Kit<br>
</div> </HTML>