aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cflow.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2017-02-07 16:53:47 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2017-02-07 16:53:47 +0100
commit6805bcf7b3ddd78bcbe0e25618ccaf0429ff78ec (patch)
treeb792bd084730ddd0cb18b1399ebf6d29d6200da2 /cparser/Cflow.ml
parent65103cdcf96b8c0411c9a7fec62a00daf6b5cb2e (diff)
downloadcompcert-kvx-6805bcf7b3ddd78bcbe0e25618ccaf0429ff78ec.tar.gz
compcert-kvx-6805bcf7b3ddd78bcbe0e25618ccaf0429ff78ec.zip
Cflow: analysis of "switch" was too imprecise
Plus: updated comments.
Diffstat (limited to 'cparser/Cflow.ml')
-rw-r--r--cparser/Cflow.ml5
1 files changed, 3 insertions, 2 deletions
diff --git a/cparser/Cflow.ml b/cparser/Cflow.ml
index 7de5cf59..f5408c15 100644
--- a/cparser/Cflow.ml
+++ b/cparser/Cflow.ml
@@ -14,7 +14,8 @@
(* *********************************************************************)
(* A simple control flow analysis for C statements.
- Main purpose: emit warnings for _Noreturn functions. *)
+ Main purpose: emit warnings for non-void functions that fall through,
+ and for _Noreturn functions that can return. *)
open C
open Cutil
@@ -148,7 +149,7 @@ let case (s: flow) : flow = fun i ->
s { i with inormal = i.inormal || i.iswitch }
let switch (s: flow) : flow = fun i ->
- s { i with inormal = false; iswitch = true }
+ s { i with inormal = false; iswitch = i.inormal }
(* This is the flow for an infinite loop with body [s].
There is no fallthrough exit, but all other exits from [s] are preserved. *)