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

Solaris Sparc build broken due to deprecated & operator in asmcomp/emit.ml (generated from asmcomp/sparc/emit.mlp) #6227

Closed
vicuna opened this issue Nov 5, 2013 · 11 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Nov 5, 2013

Original bug ID: 6227
Reporter: @johnwhitington
Assigned to: @mshinwell
Status: closed (set by @xavierleroy on 2015-12-11T18:24:21Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.01.0
Category: back end (clambda to assembly)
Has duplicate: #6229

Bug description

In "make opt":

byterun/ocamlrun tools/cvt_emit < asmcomp/sparc/emit.mlp > asmcomp/emit.ml
|| { rm -f asmcomp/emit.ml; exit 2; }
boot/ocamlrun boot/ocamlc -nostdlib -I boot -strict-sequence -w +33..39 -warn-error A -I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver -I toplevel -c asmcomp/emit.mli
boot/ocamlrun boot/ocamlc -nostdlib -I boot -strict-sequence -w +33..39 -warn-error A -I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver -I toplevel -c asmcomp/emit.ml
File "asmcomp/emit.ml", line 663, characters 28-29:
Warning 3: deprecated feature: operator (&); you should use (&&) instead
File "asmcomp/emit.ml", line 667, characters 24-25:
Warning 3: deprecated feature: operator (&); you should use (&&) instead
File "asmcomp/emit.ml", line 671, characters 24-25:
Warning 3: deprecated feature: operator (&); you should use (&&) instead
File "asmcomp/emit.ml", line 632, characters 55-56:
Warning 3: deprecated feature: operator (&); you should use (&&) instead
File "asmcomp/emit.ml", line 633, characters 56-57:
Warning 3: deprecated feature: operator (&); you should use (&&) instead
File "asmcomp/emit.ml", line 67, characters 26-27:
Warning 3: deprecated feature: operator (&); you should use (&&) instead
File "asmcomp/emit.ml", line 1:
Error: Some fatal warnings were triggered (6 occurrences)
make[1]: *** [asmcomp/emit.cmo] Error 2
make[1]: Leaving directory `/export/home/admin/cpdf.solaris8.2013.10.28/ocaml-4.01.0'
make: *** [opt] Error 2

File attachments

@vicuna
Copy link
Author

vicuna commented Nov 5, 2013

Comment author: @johnwhitington

Once this is fixed, and the build started again from scratch, the next error, again in make.opt is:

cd stdlib; make allopt
make[2]: Entering directory /export/home/admin/cpdf.solaris8.2013.10.28/ocaml-4.01.0/stdlib' ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g ./Compflags pervasives.cmx-c pervasives.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags array.cmx-c array.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags list.cmx-c list.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags char.cmx-c char.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags string.cmx-c string.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags sys.cmx-c sys.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags sort.cmx-c sort.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags marshal.cmx-c marshal.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags int32.cmx-c int32.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags obj.cmx-c obj.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags int64.cmx-c int64.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags nativeint.cmx-c nativeint.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags lexing.cmx-c lexing.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags parsing.cmx-c parsing.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags set.cmx-c set.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags map.cmx-c map.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags stack.cmx-c stack.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags queue.cmx-c queue.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags camlinternalLazy.cmx-c camlinternalLazy.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags lazy.cmx-c lazy.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags stream.cmx-c stream.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags buffer.cmx-c buffer.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags printf.cmx-c printf.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags arg.cmx-c arg.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags printexc.cmx-c printexc.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags gc.cmx-c gc.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags digest.cmx-c digest.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags random.cmx-c random.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags hashtbl.cmx-c hashtbl.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags format.cmx-c format.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags scanf.cmx-c scanf.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags callback.cmx-c callback.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags camlinternalOO.cmx-c camlinternalOO.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags oo.cmx-c oo.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags camlinternalMod.cmx-c camlinternalMod.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags genlex.cmx-c genlex.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags weak.cmx-c weak.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags filename.cmx-c filename.ml ../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g./Compflags complex.cmx-c complex.ml Fatal error: exception Invalid_argument("index out of bounds") make[2]: *** [complex.cmx] Error 2 make[2]: Leaving directory/export/home/admin/cpdf.solaris8.2013.10.28/ocaml-4.01.0/stdlib'
make[1]: *** [libraryopt] Error 2
make[1]: Leaving directory `/export/home/admin/cpdf.solaris8.2013.10.28/ocaml-4.01.0'
make: *** [opt] Error 2

So it looks like something else is wrong too.

@vicuna
Copy link
Author

vicuna commented Nov 6, 2013

Comment author: @johnwhitington

I've attached a diff for the first problem (& vs &&).

@vicuna
Copy link
Author

vicuna commented Nov 7, 2013

Comment author: @alainfrisch

Patch committed to the trunk (rev 14271), thanks.

@vicuna
Copy link
Author

vicuna commented Nov 7, 2013

Comment author: @johnwhitington

Thanks Alain.

For the next problem, I'm new to hacking the compiler, and have a question:

Here's the error I'm trying to track down:

../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g ./Compflags complex.cmx -c complex.ml
Fatal error: exception Invalid_argument("index out of bounds")
(Cannot print stack backtrace: program not linked with -g)

Presumably this error is from ../ocamlopt rather than ../boot/ocamlrun? How can I get the ../ocamlopt built in the "make world" phase linked with -g?

@vicuna
Copy link
Author

vicuna commented Nov 7, 2013

Comment author: @alainfrisch

Thanks to you for tracking this down (I don't think any OCaml developer as access to a Sparc Solaris machine these days -- it would be great if the ocamlot project could have such an access).

Adding "-g" to the COMPFLAGS variable in the main Makefile should give you an ocamlopt which supports backtraces (assuming you define OCAMLRUNPARAM=b=1).

@vicuna
Copy link
Author

vicuna commented Nov 7, 2013

Comment author: @johnwhitington

So with COMPFLAGS and LINKFLAGS with -g, I get this

../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g ./Compflags complex.cmx -c complex.ml
Fatal error: exception Invalid_argument("index out of bounds")
Raised at file "driver/optcompile.ml", line 109, characters 10-11
Called from file "driver/optmain.ml", line 22, characters 2-42
Called from file "arg.ml", line 207, characters 11-20
Called from file "arg.ml", line 219, characters 4-32
Called from file "driver/optmain.ml", line 154, characters 4-72
Re-raised at file "driver/opterrors.ml", line 81, characters 33-34
Called from file "format.ml", line 1198, characters 6-15
Called from file "driver/optmain.ml", line 204, characters 4-32
Called from file "driver/optmain.ml", line 207, characters 8-15

Which doesn't seem immediately helpful, since line 109 in optcompile is a reraise of a problem which is probably in Asmgen.compile_implementaion at line 98.

If one removes the try…with block to allow the real error to be apparent:

../boot/ocamlrun ../ocamlopt -warn-error A -nostdlib -g ./Compflags complex.cmx -c complex.ml
Fatal error: exception Invalid_argument("index out of bounds")
Raised by primitive operation at file "asmcomp/coloring.ml", line 106, characters 36-45
Called from file "asmcomp/coloring.ml", line 72, characters 8-13
Called from file "list.ml", line 73, characters 12-15
Called from file "asmcomp/coloring.ml", line 81, characters 4-49
Called from file "asmcomp/coloring.ml", line 101, characters 6-578
Called from file "list.ml", line 73, characters 12-15
Called from file "asmcomp/asmgen.ml", line 49, characters 2-31
Called from file "asmcomp/asmgen.ml", line 62, characters 2-461
Called from file "list.ml", line 73, characters 12-15
Called from file "asmcomp/asmgen.ml", line 108, characters 4-119
Re-raised at file "asmcomp/asmgen.ml", line 131, characters 10-11
Called from file "driver/optcompile.ml", line 86, characters 6-659
Called from file "driver/optmain.ml", line 22, characters 2-42
Called from file "arg.ml", line 207, characters 11-20
Called from file "arg.ml", line 219, characters 4-32
Called from file "driver/optmain.ml", line 154, characters 4-72
Re-raised at file "driver/opterrors.ml", line 81, characters 33-34
Called from file "format.ml", line 1198, characters 6-15
Called from file "driver/optmain.ml", line 204, characters 4-32
Called from file "driver/optmain.ml", line 207, characters 8-15

I'm using a customer's machine, so unfortunately I can't give you access to it, but I can try out patches.

bash-2.03$ uname -a
SunOS doc-ltx-uat-app-01 5.8 Generic_Virtual sun4u sparc SUNW,UltraAX-i2

The problem must be new since OCaml 3.10.2, since that's the version the customer is already using, and I compiled it for them.

On the question of machines for testing, my customer is using www.siteox.com which will rent Solaris, AIX and HP/UX machines by the day, so I think I'll do that for the next version of our command line PDF tools, and try to ship binaries for all those platforms.

@vicuna
Copy link
Author

vicuna commented Nov 8, 2013

Comment author: @mshinwell

Could you add a line between lines 104 and 105 of asmcomp/coloring.ml (immediately after the "let n =", but before the "if") to print the values of the following:

n
cl
first_reg
num_regs
Array.length score

I have a feeling that [n] may be negative...

@vicuna
Copy link
Author

vicuna commented Nov 8, 2013

Comment author: @xavierleroy

I was able to reproduce and narrow the problem. It seems to stem from Sparc's peculiar C calling conventions whereas float arguments are passed in pairs of integer registers. This causes an ill-typed preference to be recorded between a float variable and an integer register. I'm preparing a fix.

@vicuna
Copy link
Author

vicuna commented Nov 8, 2013

Comment author: @xavierleroy

Tentative fix committed to 4.01 branch (r14272) and to trunk (r14273). Patch against 4.01 attached to this PR, name r14272.diff. Feedback welcome.

@vicuna
Copy link
Author

vicuna commented Nov 8, 2013

Comment author: @glondu

ocamlopt now compiles on sparc and the only tests that fail are related to backtraces... but those failures are not specific to sparc so they deserve their own report (if any).

@vicuna
Copy link
Author

vicuna commented Nov 11, 2013

Comment author: @johnwhitington

Both "make opt" and "make opt.opt" now complete here. Thanks!

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

2 participants