-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ocamlopt.opt on 32 bit arm segfaults compiling ounit 2.0.0 #6484
Comments
Comment author: Richard Jones camlp4 also fails to build on arm 32 bit in the same way. /usr/bin/ocamlopt.opt unix.cmxa -I /usr/lib/ocaml/ocamlbuild /usr/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa myocamlbuild_config.ml myocamlbuild.ml /usr/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
Stack trace is the same as above: Core was generated by `/usr/bin/ocamlopt.opt unix.cmxa -I /usr/lib/ocaml/ocamlbuild /usr/lib/ocaml/oca'. |
Comment author: Richard Jones The script I am now using to bisect this problem is below. $HOME/d/ocaml contains ocaml sources (from git, branch 4.02) $HOME/d/camlp4 contains camlp4 sources (from git) #!/bin/bash sources=$HOME/d/ocaml cd $HOME/d/camlp4 |
Comment author: @mshinwell Does a stack overflow cause a segfault on that architecture? Maybe try rerunning with an increased "ulimit -s". (Although, from the values you've printed, it does look like the heap may be corrupted.) |
Comment author: Richard Jones Yup, I've tried increasing the stack limits, and it makes no difference. Dump of assembler code for function caml_oldify_mopup: (gdb) info registers |
Comment author: @mshinwell OK. Can you build the compiler with the debug runtime enabled, and see if we hit any of the assertions? |
Comment author: Richard Jones We don't hit any assertions. It simply crashes in the same place. How do you enable debugging? In Fedora we carry a custom patch so we can supply our own $CFLAGS: |
Comment author: Richard Jones Just to be clear about the previous comment: (1) I enabled debug runtime and there are no assertions. (2) The question about enabling debugging applies to the other bug I'm looking at (#6486). |
Comment author: @mshinwell I'm not sure what you mean by "enabling debugging". Could you clarify? I think it's worth trying the same approach using a watchpoint as I've just written in mantis 6486. |
Comment author: @mshinwell (Oh, and I'm now suspecting that the repeated stack frames in Selectgen might be due to a different bug, as noted on 6486. Although doesn't aarch64 use frame pointers for unwinding? I don't remember offhand.) |
Comment author: Richard Jones I am able to get through a compile of camlp4 by disabling the new CSE optimization added in 4.02. Didn't test yet whether this also fixes the oUnit build. The patch I'm using is this one: #6486#c11823 |
Comment author: Richard Jones I finally got through a git bisect. Unfortunately because I had to skip a lot of ARM breakage it's not very conclusive, but here it is: There are only 'skip'ped commits left to test. |
Comment author: @xavierleroy Problem in CSE diagnosed and tentative fix pushed to 4.02 branch (commit 15012) and trunk (15013). With the fix, ocamlopt.opt reliably compiles Camlp4 on ARMv7-hardfloat. |
Original bug ID: 6484
Reporter: Richard Jones
Assigned to: @mshinwell
Status: resolved (set by @xavierleroy on 2014-07-18T14:14:18Z)
Resolution: fixed
Priority: normal
Severity: crash
Version: 4.02.0+beta1 / +rc1
Target version: 4.02.0+dev
Fixed in version: 4.02.0+dev
Category: back end (clambda to assembly)
Related to: #6486 #7307
Monitored by: meurer @avsm
Bug description
ocamlopt.opt (armv7hl) segfaults when compiling one file
from ounit 2.0.0.
I am using ocaml 4.02 (commit 8c1e5cd), on 32 bit ARM.
When building ounit, the following command segfaults:
File "src/oUnitConf.ml", line 77, characters 16-35:
Warning 3: deprecated feature: String.set
ocamlopt.opt got signal and exited
Command exited with code 2.
I captured a core dump and the stack trace is:
Core was generated by `ocamlopt.opt -c -g -I src -I src -I src -o src/oUnitConf.cmx -thread src/oUnitC'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0014c208 in caml_oldify_mopup () at minor_gc.c:206
206 oldify_todo_list = Field (new_v, 1); /* Remove from list. */
Missing separate debuginfos, use: debuginfo-install glibc-2.19.90-26.fc21.armv7hl libgcc-4.9.0-14.fc21.armv7hl
(gdb) bt
#0 0x0014c208 in caml_oldify_mopup () at minor_gc.c:206
#1 0x0014c308 in caml_empty_minor_heap () at minor_gc.c:237
#2 0x0014c410 in caml_minor_collection () at minor_gc.c:276
#3 0x0014b2b0 in caml_garbage_collection () at signals_asm.c:70
#4 0x0015be1c in caml_call_gc ()
#5 0x00032fac in camlSelectgen__fun_2006 ()
#6 0x00032fac in camlSelectgen__fun_2006 ()
#7 0x00032fac in camlSelectgen__fun_2006 ()
#8 0x00032fac in camlSelectgen__fun_2006 ()
#9 0x00032fac in camlSelectgen__fun_2006 ()
#10 0x00032fac in camlSelectgen__fun_2006 ()
#11 0x00032fac in camlSelectgen__fun_2006 ()
#12 0x00032fac in camlSelectgen__fun_2006 ()
[same stack frame repeated forever]
(gdb) list
201
202 while (oldify_todo_list != 0){
203 v = oldify_todo_list; /* Get the head. /
204 Assert (Hd_val (v) == 0); / It must be forwarded. /
205 new_v = Field (v, 0); / Follow forward pointer. /
206 oldify_todo_list = Field (new_v, 1); / Remove from list. /
207
208 f = Field (new_v, 0);
209 if (Is_block (f) && Is_young (f)){
210 caml_oldify_one (f, &Field (new_v, 0));
(gdb) print oldify_todo_list
$1 = -1228923798
(gdb) print ((value)oldify_todo_list)[-1]
$5 = 0
(gdb) print ((value*)oldify_todo_list)[0]
$2 = 25600
(gdb) print ((value*)oldify_todo_list)[1]
$3 = 1640235008
(gdb) print ((value*)oldify_todo_list)[2]
$4 = 243318
(gdb) print ((value*)25600)[0]
Cannot access memory at address 0x6400
Note that the crash is not 100% reliable by any means. On my
local hardware it happens, but rarely. On the Fedora builders
it happens quite often but not always.
Steps to reproduce
Build & install ocaml 4.02 from git (https://github.com/ocaml/ocaml)
Download ounit 2.0.0 from http://ounit.forge.ocamlcore.org/
zcat ounit-2.0.0.tar.gz | tar xf -
./configure
make all
You may need to repeat `make clean ; make all'
several times since the crash isn't 100% reliable.
Additional information
Works fine on x86.
The text was updated successfully, but these errors were encountered: