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

assembler complains of invalid code #5910

Closed
vicuna opened this issue Jan 28, 2013 · 11 comments
Closed

assembler complains of invalid code #5910

vicuna opened this issue Jan 28, 2013 · 11 comments

Comments

@vicuna
Copy link

vicuna commented Jan 28, 2013

Original bug ID: 5910
Reporter: jteg68
Assigned to: meurer
Status: closed (set by @xavierleroy on 2015-12-11T18:27:35Z)
Resolution: fixed
Priority: normal
Severity: major
Platform: raspberrypi
OS: raspbian
Version: 4.00.1
Fixed in version: 4.00.2+dev
Category: back end (clambda to assembly)
Has duplicate: #5994 #6006 #6131
Monitored by: wime astronouth7303 @gasche

Bug description

Running 'opam install ocamlnet' the build always stops due to errors in the generated assmbler code.
The computer is a raspberrypi with a patched ocaml compiler.

root@raspberrypi:~# ocamlc -v
The OCaml compiler, version 4.00.1
Standard library directory: /root/.opam/4.00.1+raspberrypi/lib/ocaml

root@raspberrypi:~# uname -a
Linux raspberrypi 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012 armv6l GNU/Linux

result from 'opam install --debug ocamlnet 2> opam.err'
root@raspberrypi:~# tail opam.err -n30
...
make[1]: Leaving directory /root/.opam/4.00.1+raspberrypi/build/ocamlnet.3.6.0/src/netmech-scram' make[1]: Entering directory /root/.opam/4.00.1+raspberrypi/build/ocamlnet.3.6.0/src/netmech-scram'
ocamlfind ocamlopt -I ../../src/netsys -I ../../src/netstring -I ../../src/netgssapi -package "cryptokit unix" -c netmech_scram.ml
make[1]: Leaving directory `/root/.opam/4.00.1+raspberrypi/build/ocamlnet.3.6.0/src/netmech-scram'

stderr

...[truncated]
Warning 11: this match case is unused.
File "nethttpd_services.ml", line 1118, characters 4-5:
Warning 11: this match case is unused.
/tmp/camlasm26c358.s: Assembler messages:
/tmp/camlasm26c358.s:9540: Error: shift expression is too large
/tmp/camlasm26c358.s:9632: Error: shift expression is too large
File "netmech_scram.ml", line 1:
Error: Assembler error, input left in file /tmp/camlasm26c358.s
make[1]: *** [netmech_scram.cmx] Fel 2
make: *** [opt] Fel 2

[17247] 17247 unlocking /root/.opam/4.00.1+raspberrypi/lock
'opam install --debug eliom' failed.

Steps to reproduce

opam install ocamlnet

File attachments

@vicuna
Copy link
Author

vicuna commented Jan 28, 2013

Comment author: jteg68

The original command was 'opam install eliom', but as the offending file is in ocamlnet I also tried 'opam install ocamlnet'. The output file is from the eliom install attempt, the result is identical in the two cases.

/Jörgen

@vicuna
Copy link
Author

vicuna commented Jan 28, 2013

Comment author: @alainfrisch

Since this seems to be a back-end related problem, it is probably related to the patched compiler you are using. I suggest to send this bug report to the maintainer of this compiler.

@vicuna
Copy link
Author

vicuna commented Jan 28, 2013

Comment author: meurer

It'd help to know what patches were used. And why don't you use the trunk/4.00.1-dev version, which already supports ARMv6?

@vicuna
Copy link
Author

vicuna commented Jan 28, 2013

Comment author: jteg68

The patch was from
http://www.cl.cam.ac.uk/projects/ocamllabs/projects/rpi.html

"...
Alternatively, you can also use OPAM to compile a custom compiler (see the Jane Street blog post above for instructions on how to install OPAM):

$ opam switch 4.00.1+raspberrypi
..."

I'll try 4.00.1-dev instead tonight.

Thanks,
Jörgen

@vicuna
Copy link
Author

vicuna commented Jan 28, 2013

Comment author: jteg68

root@raspberrypi:~# opam switch show
4.01.0dev+trunk

'opam install eliom' gave the output below. It looks like the same error as before.

The offending instruction seems to be
mov r2, r1, lsl #32

/Jörgen

==== ERROR [while recompiling ocamlnet.3.6.0] ====

command make opt

path /root/.opam/4.01.0dev+trunk/build/ocamlnet.3.6.0

exit-code 2

env-file /root/.opam/4.01.0dev+trunk/build/ocamlnet.3.6.0/ocamlnet-d37749.env

stdout-file /root/.opam/4.01.0dev+trunk/build/ocamlnet.3.6.0/ocamlnet-d37749.out

stderr-file /root/.opam/4.01.0dev+trunk/build/ocamlnet.3.6.0/ocamlnet-d37749.err

stdout

...[truncated]
make[2]: Entering directory /root/.opam/4.01.0dev+trunk/build/ocamlnet.3.6.0/src/netmech-scram' make[2]: Inget behöver göras för "realgenerate". make[2]: Leaving directory /root/.opam/4.01.0dev+trunk/build/ocamlnet.3.6.0/src/netmech-scram'
make[1]: Leaving directory /root/.opam/4.01.0dev+trunk/build/ocamlnet.3.6.0/src/netmech-scram' make[1]: Entering directory /root/.opam/4.01.0dev+trunk/build/ocamlnet.3.6.0/src/netmech-scram'
make[1]: "depend" är färsk.
make[1]: Leaving directory /root/.opam/4.01.0dev+trunk/build/ocamlnet.3.6.0/src/netmech-scram' make[1]: Entering directory /root/.opam/4.01.0dev+trunk/build/ocamlnet.3.6.0/src/netmech-scram'
ocamlfind ocamlopt -I ../../src/netsys -I ../../src/netstring -I ../../src/netgssapi -package "cryptokit unix" -c netmech_scram.ml
make[1]: Leaving directory `/root/.opam/4.01.0dev+trunk/build/ocamlnet.3.6.0/src/netmech-scram'

stderr

...[truncated]
Warning 11: this match case is unused.
File "nethttpd_services.ml", line 1118, characters 4-5:
Warning 11: this match case is unused.
/tmp/camlasm209b09.s: Assembler messages:
/tmp/camlasm209b09.s:9460: Error: shift expression is too large
/tmp/camlasm209b09.s:9552: Error: shift expression is too large
File "netmech_scram.ml", line 1:
Error: Assembler error, input left in file /tmp/camlasm209b09.s
make[1]: *** [netmech_scram.cmx] Fel 2
make: *** [opt] Fel 2

@vicuna
Copy link
Author

vicuna commented Jan 29, 2013

Comment author: meurer

It looks like a bug in the ARM instruction selection. I'll try to look into this during the week.

@vicuna
Copy link
Author

vicuna commented Apr 1, 2013

Comment author: guleesh

any progress on this issue ?
I have encountered the same problem with , shift expression is too large

Again the problem seems to be
lsl #32

which is too large for ARM6 (?)

@vicuna
Copy link
Author

vicuna commented May 7, 2013

Comment author: meurer

I'm sorry, I was too busy with real life to have a look at the issue. The problem is indeed related to the shift left by 32. I'm going to push a fix later.

@vicuna
Copy link
Author

vicuna commented May 8, 2013

Comment author: meurer

Fixed in trunk and version/4.00.

@vicuna
Copy link
Author

vicuna commented May 10, 2013

Comment author: wime

Thanks for the fix!

@vicuna
Copy link
Author

vicuna commented May 19, 2014

Comment author: vaidas

Problem still exists as I see in file in trunk: https://godirepo.camlcity.org/wwwsvn/trunk/code/src/netmech-scram/netmech_scram.ml?rev=1954&root=lib-ocamlnet2&view=markup

One line is fixed but there is another line in next function which also needs to be fixed.
It is in line 1344. Please fix this.

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