interp: report 'unreachable' instruction as an error

This instruction should never be hit in real programs, but the
interpreter may hit it after a call to panic(). This would always be a
runtime error.
This commit is contained in:
Ayke van Laethem
2018-12-01 16:16:11 +01:00
parent cea0a5977a
commit 469193735a
2 changed files with 12 additions and 5 deletions
+3
View File
@@ -63,6 +63,9 @@ func Run(mod llvm.Module, targetData llvm.TargetData, debug bool) error {
}
pkgName := initName[:len(initName)-5]
_, err := e.Function(call.CalledValue(), nil, pkgName)
if err == ErrUnreachable {
break
}
if err != nil {
return err
}