aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Maxime Dénès <mail@maximedenes.fr>2017-04-04 13:37:51 +0200
committerGravatar Maxime Dénès <mail@maximedenes.fr>2017-04-04 13:37:51 +0200
commit57c673d0aa411facc2fc8fa222e7653041b282ea (patch)
tree6c2dd05f6eac810ffd639e7d47e0b3612c1557c2
parent32bf31fda75918bf2910301dffa7b3137c81b236 (diff)
parent70bcfcf5b2ea485ebe253158c37b89dfac63820b (diff)
Merge PR#535: Fix #5435: [Eval native_compute in] raises anomaly.
-rw-r--r--kernel/nativecode.ml5
-rw-r--r--test-suite/bugs/closed/5435.v2
2 files changed, 5 insertions, 2 deletions
diff --git a/kernel/nativecode.ml b/kernel/nativecode.ml
index eaddace4b..b17715a8f 100644
--- a/kernel/nativecode.ml
+++ b/kernel/nativecode.ml
@@ -1849,9 +1849,10 @@ and apply_fv env sigma univ (fv_named,fv_rel) auxdefs ml =
and compile_rel env sigma univ auxdefs n =
let open Context.Rel in
- let n = length env.env_rel_context - n in
let open Declaration in
- match lookup n env.env_rel_context with
+ let decl = lookup n env.env_rel_context in
+ let n = length env.env_rel_context - n in
+ match decl with
| LocalDef (_,t,_) ->
let code = lambda_of_constr env sigma t in
let auxdefs,code = compile_with_fv env sigma univ auxdefs None code in
diff --git a/test-suite/bugs/closed/5435.v b/test-suite/bugs/closed/5435.v
new file mode 100644
index 000000000..60ace5ce9
--- /dev/null
+++ b/test-suite/bugs/closed/5435.v
@@ -0,0 +1,2 @@
+Definition foo (x : nat) := Eval native_compute in x.
+