Boo
  1. Boo
  2. BOO-475

try: block without except: or ensure: produces internal compiler error

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.6
    • Fix Version/s: 0.7
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      Mono 1.1.8 on Linux/x86, Mono 1.1.8 on Mac OS X, .NET 1.1 on Windows XP SP2
    • Number of attachments :
      0

      Description

      A try block with no following except: or ensure: blocks produces an internal compiler error or runtime crash. Sample code:

      try:
      print "Foo"

      On the .NET 1.1 runtime the low-level ILGenerator throws an exception which is caught and returned as an ICE:
      ERROR: Internal compiler error: Incorrect code generation for exception block.

      On Mono an assertion failure simply crashes the runtime:

        • ERROR **: file reflection.c: line 835 (method_encode_clauses): assertion failed: (ex_info->handlers)
          aborting...

      The case should probably be caught as illegal at a higher level and a descriptive error message returned; or if it's meant to be possible to do this, an empty catch block needs to be implicitly added in the emitted IL.

      I've posted a short C# program which triggers the same emitter error on my bug report for the assertion failure on Mono:
      http://bugzilla.ximian.com/show_bug.cgi?id=76002

        Activity

        Hide
        Doug H added a comment -

        If we have a try block with no except, should it be a syntax error, or should it add an except handler that re-raises, or an except that passes?

        except e:
        raise

        or

        except e:
        pass //nothing happens if exception occurs

        I'm guessing maybe the raise one is best, although technically "pass" means an empty block.

        Show
        Doug H added a comment - If we have a try block with no except, should it be a syntax error, or should it add an except handler that re-raises, or an except that passes? except e: raise or except e: pass //nothing happens if exception occurs I'm guessing maybe the raise one is best, although technically "pass" means an empty block.

          People

          • Assignee:
            Rodrigo B. de Oliveira
            Reporter:
            Brion Vibber
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: