Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2018-05

Issue #32913 - Internal Error 200309201

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

J. Gareth Moreton

Hi everyone,
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.
What I've found so far, using the following code example:

 program undefined_symbol_bug;
 uses SysUtils;

procedure p;
   begin
      try
        {a}
      except
        on e: Exception do
          try
            {b}
          finally
            {c}
          end;
      end;
   end;

 begin
   p;
 end.

{a}, {b} and {c} are replaced with simple WriteLn or Exit commands, or left blank.

- 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.
- If {a} is not empty, then the program normally compiles whether or not {b} or {c} is empty, except in one circumstance...
- If {b} contains "Exit", then the assembly produced is missing a label and fails to link.

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.

Gareth aka. Kit

Reply by email