Status: New
Owner: ----

New issue 2529 by [email protected]: Dead code changes the return value in try-finally blocks
http://code.google.com/p/v8/issues/detail?id=2529

The following code blocks differ only in dead code:

A:
---
while(true) {
  try{
    "try" ;
    break
  } finally {
    "finally"
  }
}
---

B:
---
while(true) {
  try{
    "try" ;
    break
  } finally {
    "finally"
  } ;
  y = "done"
}
---

Since the loop is broken inside the try, the assignment never executes. And yet block A returns "finally" while block B returns "try".

Perhaps even more entertainingly:

C:
---
while(true) {
  try{
    "try" ;
    break
  } finally {
    "finally"
  } ;
  if(true){2}
  else {var x = 3}
}
---

D:
---
while(true) {
  try{
    "try" ;
    break
  } finally {
    "finally"
  } ;
  if(true){2}
  else {3}
}
---

C and D are identical except for some dead code, which is identical except for some even deader code (inside the false branch of the if). And yet C returns "finally" while D returns "try".

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to