-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Original bug ID: 5334
Reporter: @glondu
Status: closed (set by @xavierleroy on 2013-08-31T10:43:59Z)
Resolution: won't fix
Priority: normal
Severity: minor
Version: 3.12.0
Category: ~DO NOT USE (was: OCaml general)
Related to: #5314
Monitored by: tgazagna mehdi @ygrek till
Bug description
On a powerpc machine:
$ uname -a
Linux pescetti 2.6.32-5-powerpc #1 Tue Jun 14 09:33:14 UTC 2011 ppc GNU/Linux
$ ocamlopt -config
version: 3.12.0
standard_library_default: /usr/lib/ocaml
standard_library: /usr/lib/ocaml
standard_runtime: /usr/bin/ocamlrun
ccomp_type: cc
bytecomp_c_compiler: gcc -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC
bytecomp_c_libraries: -lm -ldl -lcurses -lpthread
native_c_compiler: gcc -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
native_c_libraries: -lm -ldl
native_pack_linker: ld -r -o
ranlib: ranlib
cc_profile: -pg
architecture: power
model: ppc
system: elf
asm: as -u -m ppc
ext_obj: .o
ext_asm: .s
ext_lib: .a
ext_dll: .so
os_type: Unix
default_executable_name: a.out
systhread_supported: true
$ cat backtrace.c
#include <caml/mlvalues.h>
#include <execinfo.h>
value caml_backtrace(value unit) {
void *buffer[100];
return(Val_int(backtrace(buffer, 100)));
}
$ cat main.ml
external backtrace : unit -> int = "caml_backtrace";;
let f () = backtrace () + 1;;
exit (f ());;
$ ocamlopt backtrace.c main.ml && ./a.out; echo $?
zsh: segmentation fault ./a.out
139
$ ocamlc -custom backtrace.c main.ml && ./a.out; echo $?
7
This does not happen on amd64, i386, armel, sparc. It doesn't happen either when calling backtrace() in a pure C program, nor when all CAML{local,return} macros are there, nor when backtrace() in called directly at toplevel in OCaml code. I suspect ocamlopt is faulty here.