Fix (arm) code generation bug with mod 1
authorStephane Glondu <steph@glondu.net>
Fri, 26 Jul 2013 04:15:49 +0000 (06:15 +0200)
committerStephane Glondu <steph@glondu.net>
Fri, 26 Jul 2013 04:15:49 +0000 (06:15 +0200)
debian/patches/0009-Fix-code-generation-bug-with-mod-1.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/0009-Fix-code-generation-bug-with-mod-1.patch b/debian/patches/0009-Fix-code-generation-bug-with-mod-1.patch
new file mode 100644 (file)
index 0000000..171f87a
--- /dev/null
@@ -0,0 +1,25 @@
+From: Stephane Glondu <steph@glondu.net>
+Date: Fri, 26 Jul 2013 06:13:27 +0200
+Subject: Fix code generation bug with "mod 1"
+
+Backport of a patch from Benedikt Meurer. ocamlnet needs it.
+
+Bug: http://caml.inria.fr/mantis/view.php?id=5910
+---
+ asmcomp/arm/selection.ml |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/asmcomp/arm/selection.ml b/asmcomp/arm/selection.ml
+index ecda382..ef112ed 100644
+--- a/asmcomp/arm/selection.ml
++++ b/asmcomp/arm/selection.ml
+@@ -173,7 +173,7 @@ method! select_operation op args =
+   | (Cdivi, args) ->
+       (Iextcall("__aeabi_idiv", false), args)
+   | (Cmodi, [arg; Cconst_int n])
+-    when n = 1 lsl Misc.log2 n ->
++    when n > 1 && n = 1 lsl Misc.log2 n ->
+       (Iintop_imm(Imod, n), [arg])
+   | (Cmodi, args) ->
+       (* See above for fix up of return register *)
+-- 
index be80a2c41d391cd7ffbec00171812b85138e0bda..52ca655b61a3b15914b6307952036b511f2547ca 100644 (file)
@@ -6,3 +6,4 @@
 0006-Install-ocamlbuild-as-a-link-on-either-.native-or-.b.patch
 0007-Avoid-multiple-declarations-in-generated-.c-files-in.patch
 0008-Embed-bytecode-in-C-object-when-using-custom.patch
+0009-Fix-code-generation-bug-with-mod-1.patch