summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Maranget <luc.maranget@inria.fr>2001-04-30 18:08:22 +0000
committerLuc Maranget <luc.maranget@inria.fr>2001-04-30 18:08:22 +0000
commit046e095ec2d93ac8d5a60f1a6933bb51cdf1ded0 (patch)
tree97b788cdfcd27b02069657028f5a64e3954c2d54
parent157c4e54c9fd3e5ce83bd67072b74217937e42b2 (diff)
downloadocaml-046e095ec2d93ac8d5a60f1a6933bb51cdf1ded0.tar.gz
stupid bug in offsets (Switch)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3495 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rwxr-xr-xboot/ocamlcbin771980 -> 771996 bytes
-rwxr-xr-xboot/ocamllexbin86729 -> 86729 bytes
-rw-r--r--bytecomp/switch.ml13
-rw-r--r--test/Moretest/morematch.ml20
4 files changed, 29 insertions, 4 deletions
diff --git a/boot/ocamlc b/boot/ocamlc
index 245f47d29c..ce9f5337d7 100755
--- a/boot/ocamlc
+++ b/boot/ocamlc
Binary files differ
diff --git a/boot/ocamllex b/boot/ocamllex
index d52a226a68..d7c786a4c1 100755
--- a/boot/ocamllex
+++ b/boot/ocamllex
Binary files differ
diff --git a/bytecomp/switch.ml b/bytecomp/switch.ml
index 94bd585bba..f14d5a64bc 100644
--- a/bytecomp/switch.ml
+++ b/bytecomp/switch.ml
@@ -483,9 +483,9 @@ let make_if_out konst ctx l d mk_ifso mk_ifno = match l with
(konst d) ctx.arg (mk_ifso ctx) (mk_ifno ctx)
| _ ->
Arg.bind
- (Arg.make_offset ctx.arg (-l-ctx.off))
+ (Arg.make_offset ctx.arg (-l))
(fun arg ->
- let ctx = {off= (-l) ; arg=arg} in
+ let ctx = {off= (-l+ctx.off) ; arg=arg} in
do_make_if_out
(konst d) arg (mk_ifso ctx) (mk_ifno ctx))
@@ -498,9 +498,9 @@ let make_if_in konst ctx l d mk_ifso mk_ifno = match l with
(konst d) ctx.arg (mk_ifso ctx) (mk_ifno ctx)
| _ ->
Arg.bind
- (Arg.make_offset ctx.arg (-l-ctx.off))
+ (Arg.make_offset ctx.arg (-l))
(fun arg ->
- let ctx = {off= (-l) ; arg=arg} in
+ let ctx = {off= (-l+ctx.off) ; arg=arg} in
do_make_if_in
(konst d) arg (mk_ifso ctx) (mk_ifno ctx))
@@ -513,6 +513,11 @@ let rec c_test konst ctx ({cases=cases ; actions=actions} as s) =
else begin
let w,c = opt_count false cases in
+(*
+ Printf.fprintf stderr
+ "off=%d tactic=%a for %a\n"
+ ctx.off pret w pcases cases ;
+*)
match w with
| No -> actions.(get_act cases 0) ctx
| Inter (i,j) ->
diff --git a/test/Moretest/morematch.ml b/test/Moretest/morematch.ml
index ce857d60d3..e27834aa5f 100644
--- a/test/Moretest/morematch.ml
+++ b/test/Moretest/morematch.ml
@@ -721,3 +721,23 @@ test "eber" eber {x=1 ; y=0 ; z=false} 0 ; ()
;;
+(* Enchainement des test d'intervalle *)
+
+let escaped = function
+ | '"' | '\\' | '\n' | '\t' -> 2
+ | c -> 1
+;;
+
+test "escaped" escaped '"' 2 ;
+test "escaped" escaped '\\' 2 ;
+test "escaped" escaped '\n' 2 ;
+test "escaped" escaped '\t' 2 ;
+test "escaped" escaped '\000' 1 ;
+test "escaped" escaped ' ' 1 ;
+test "escaped" escaped '\000' 1 ;
+test "escaped" escaped '[' 1 ;
+test "escaped" escaped ']' 1 ;
+test "escaped" escaped '!' 1 ;
+test "escaped" escaped '#' 1 ;
+()
+;;