Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006227OCamlOCaml backend (code generation)public2013-11-05 12:112013-11-11 13:44
Reporterjohnwhitington 
Assigned Toshinwell 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.01.0 
Target VersionFixed in Version 
Summary0006227: Solaris Sparc build broken due to deprecated & operator in asmcomp/emit.ml (generated from asmcomp/sparc/emit.mlp)
DescriptionIn "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
TagsNo tags attached.
Attached Filesdiff file icon sparc-and.diff [^] (1,731 bytes) 2013-11-06 19:18 [Show Content]
diff file icon r14272.diff [^] (2,750 bytes) 2013-11-08 16:09 [Show Content]

- Relationships
has duplicate 0006229resolved Compilation of ocamlopt fails on sparc 

-  Notes
(0010589)
johnwhitington (reporter)
2013-11-05 13:26

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.
(0010597)
johnwhitington (reporter)
2013-11-06 19:19

I've attached a diff for the first problem (& vs &&).
(0010598)
frisch (developer)
2013-11-07 12:04

Patch committed to the trunk (rev 14271), thanks.
(0010599)
johnwhitington (reporter)
2013-11-07 12:50

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?
(0010600)
frisch (developer)
2013-11-07 14:49

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).
(0010601)
johnwhitington (reporter)
2013-11-07 17:18

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.
(0010603)
shinwell (developer)
2013-11-08 11:58

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...
(0010604)
xleroy (administrator)
2013-11-08 15:49

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.
(0010605)
xleroy (administrator)
2013-11-08 16:10

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.
(0010609)
glondu (reporter)
2013-11-08 19:49

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).
(0010616)
johnwhitington (reporter)
2013-11-11 13:44

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

- Issue History
Date Modified Username Field Change
2013-11-05 12:11 johnwhitington New Issue
2013-11-05 13:26 johnwhitington Note Added: 0010589
2013-11-06 19:18 johnwhitington File Added: sparc-and.diff
2013-11-06 19:19 johnwhitington Note Added: 0010597
2013-11-07 12:04 frisch Note Added: 0010598
2013-11-07 12:50 johnwhitington Note Added: 0010599
2013-11-07 14:49 frisch Note Added: 0010600
2013-11-07 17:18 johnwhitington Note Added: 0010601
2013-11-08 11:58 shinwell Note Added: 0010603
2013-11-08 11:59 shinwell Assigned To => shinwell
2013-11-08 11:59 shinwell Status new => assigned
2013-11-08 15:49 xleroy Note Added: 0010604
2013-11-08 16:09 xleroy File Added: r14272.diff
2013-11-08 16:10 xleroy Note Added: 0010605
2013-11-08 16:10 xleroy Status assigned => resolved
2013-11-08 16:10 xleroy Resolution open => fixed
2013-11-08 16:23 xleroy Relationship added has duplicate 0006229
2013-11-08 19:49 glondu Note Added: 0010609
2013-11-11 13:44 johnwhitington Note Added: 0010616


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker