Skip to content
Snippets Groups Projects

Fix potential stack overflow related to `Pretty N`.

Merged Robbert Krebbers requested to merge robbert/pretty_N_go_stackoverflow into master
All threads resolved!
2 files
+ 13
1
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 12
0
From stdpp Require Import pretty.
From Coq Require Import Ascii.
Section N.
Local Open Scope N_scope.
@@ -17,6 +18,17 @@ Section N.
Proof. reflexivity. Qed.
End N.
(** Minimized version of:
https://coq.zulipchat.com/#narrow/stream/237977-Coq-users/topic/Stack.20overflow.20in.20Qed.2E
Fixed by making the [wp_guard] in [pretty_N_go] proportional to the
size of the input so that it blocks in case the input is an open term. *)
Lemma test_no_stack_overflow p n :
get n (pretty (N.pos p)) Some "_"%char
get (S n) ("-" +:+ pretty (N.pos p)) Some "_"%char.
Proof. intros Hlem. apply Hlem. Qed.
Section nat.
Local Open Scope nat_scope.
Loading