Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot "ocamlopt" the expression "x mod 1" on ARM #6006

Closed
vicuna opened this issue May 5, 2013 · 0 comments
Closed

Cannot "ocamlopt" the expression "x mod 1" on ARM #6006

vicuna opened this issue May 5, 2013 · 0 comments

Comments

@vicuna
Copy link

vicuna commented May 5, 2013

Original bug ID: 6006
Reporter: wime
Assigned to: meurer
Status: closed (set by @xavierleroy on 2015-12-11T18:18:52Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.00.1
Fixed in version: 4.00.2+dev
Category: back end (clambda to assembly)
Duplicate of: #5910
Monitored by: @gasche

Bug description

When I tried to compile ocamlnet on a Pandaboard the compiler failed with the messages

...
/tmp/camlasm0de67d.s: Assembler messages:
/tmp/camlasm0de67d.s:9339: Error: shift expression is too large -- mov r0,r1,lsl#32' /tmp/camlasm0de67d.s:9431: Error: shift expression is too large -- mov r4,r5,lsl#32'
File "netmech_scram.ml", line 1:
Error: Assembler error, input left in file /tmp/camlasm0de67d.s
make[1]: *** [netmech_scram.cmx] Fehler 2
make: *** [opt] Fehler 2

Steps to reproduce

The following simplified code produces a similar error if you "ocamlopt" it. ocamlc works fine.

let x = (Random.int 255) in print_int (x mod 1);

Additional information

Currently "x mod 1" results in an left bit shift of 32 bits (lsl#32), which is not allowed on ARM. I was able to circumvent this problem by applying the attached patch, which limits the shift width to 31 bits and handles 32 bits in a separate case. It might need some refinement.

File attachments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant