Closed
Bug 214945
Opened 21 years ago
Closed 21 years ago
finally not executed if try empty
Categories
(Rhino Graveyard :: Compiler, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
1.5R5
People
(Reporter: okidoky, Assigned: norrisboyd)
References
Details
Attachments
(1 file)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20021213 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20021213 (Appologies in advance if this bug was already reported.) When there is no code in a try block, then the finally block is not executed. Reproducible: Always Steps to Reproduce: try { } finally { print(123 } Actual Results: (nothing) Expected Results: 123 I tried this with the command line 'js', which seems to default to interprete mode. When I do js -opt 9, I get the same results, so it looks like the compiler is also affected. In C's version 'SpiderMonkey' does appear to work, and does print the 123 message. If I add a semicolon, it works: js> try { ; } finally { print(123) } 123
Comment 1•21 years ago
|
||
The bug is triggered by an incorrect optimization in createTryCatchFinally of omj/IRFactory.java where it removes all try/catch/finally as long as try is empty. The patch changes that to apply optimization only if finally is empty as well. In principle the case of empty try with a non-trivial finally can be replaced by just the finally block instead of generating full code for try/catch/finally support but IMO it does not that frequent to bother.
Comment 2•21 years ago
|
||
I committed the fix
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 3•21 years ago
|
||
*** Bug 217591 has been marked as a duplicate of this bug. ***
You need to log in
before you can comment on or make changes to this bug.
Description
•