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

Illegal Instruction on Mac Intel #4036

Closed
vicuna opened this issue Jun 1, 2006 · 7 comments
Closed

Illegal Instruction on Mac Intel #4036

vicuna opened this issue Jun 1, 2006 · 7 comments
Assignees
Labels

Comments

@vicuna
Copy link

vicuna commented Jun 1, 2006

Original bug ID: 4036
Reporter: dellaert
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2006-07-18T07:36:58Z)
Resolution: fixed
Priority: normal
Severity: crash
Version: 3.09.2
Category: ~DO NOT USE (was: OCaml general)
Related to: #4114
Monitored by: kentaur

Bug description

when compiling natively on Mac Intel programs crash with "Illegal instruction". I know this has been reported before and supposedly resolved in 3.09.2, and indeed a small "hello world" program compiles and runs without problem. However, our real applications link with lablgtk and lablGL and various other libraries, and always crash (they run fine as bytecode). In two cases I ran gdb to see where it occurs, and both cases it was during the garbage collection. Below a backtrace...

Additional information

Here is a backtrace from gdb:

Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/operand.
0x8fe136e4 in __dyld_stub_binding_helper_interface ()
(gdb) bt
#0 0x8fe136e4 in __dyld_stub_binding_helper_interface ()
#1 0x00000000 in ?? ()
#2 0x0039479d in caml_process_pending_signals ()
#3 0x0039491f in caml_garbage_collection ()
#4 0x002509a0 in caml_call_gc ()
Previous frame inner to this frame (corrupt stack?)
(gdb) q

@vicuna
Copy link
Author

vicuna commented Jun 8, 2006

Comment author: @xavierleroy

Probably a stack alignment issue: dyld_stub and various other C functions
demand a stack pointer that is 16-byte aligned. It would be helpful
to determine the values of the stack pointer in the various frames.
Under gdb, please do something like

frame 0
p/x $sp
frame 1
p/x $sp
frame 2
p/x $sp
frame 3
p/x $sp
frame 4
p/x $sp

and tell us the results.

@vicuna
Copy link
Author

vicuna commented Jun 8, 2006

Comment author: dellaert

OK, here it is:

(gdb) r
Starting program: /Users/dellaert/projects/rig/caml/main.exe
Reading symbols for shared libraries ..........................................+......+++++...+.+...................+.++++.+++....... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done

Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/operand.
0x8fe136e4 in __dyld_stub_binding_helper_interface ()
(gdb) frame 0
#0 0x8fe136e4 in __dyld_stub_binding_helper_interface ()
(gdb) p/x $sp
$1 = 0xbffff3bc
(gdb) frame 1
#1 0x00000000 in ?? ()
(gdb) p/x $sp
$2 = 0xbffff424
(gdb) frame 2
#2 0x0039d155 in caml_process_pending_signals ()
(gdb) p/x $sp
$3 = 0xbffff47c
(gdb) frame 3
#3 0x0039d2d7 in caml_garbage_collection ()
(gdb) p/x $sp
$4 = 0xbffff4ac
(gdb) frame 4
#4 0x002585a0 in caml_call_gc ()
(gdb) p/x $sp
$5 = 0xbffff4bc
(gdb) q
The program is running. Exit anyway? (y or n) y

@vicuna
Copy link
Author

vicuna commented Jun 10, 2006

Comment author: @xavierleroy

This is indeed a stack alignment problem. I'll track it down when
I have again access to a Mac/Intel machine.

@vicuna
Copy link
Author

vicuna commented Jun 26, 2006

Comment author: kentaur

Is there anything I can do to help with tracking down this problem? I've access to MacBook Pro.

@vicuna
Copy link
Author

vicuna commented Jul 14, 2006

Comment author: @xavierleroy

Hello,

I'm now the happy owner of a MacBook Pro, so I'm finally in a position
to investigate the stack alignment problem for ocamlopt code that you
reported. Could you send me (Xavier.Leroy@inria.fr) some source code
that reproduces the crash? It doesn't matter if the code is big as
long as I can recompile it (with additional instrumentation code) on
my machine. I have darwinports installed.

Best regards,

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Jul 14, 2006

Comment author: @xavierleroy

Follow-up: I ran into a similar stack alignment problem with another
LablGTK2 application, and was able to fix it. Before bothering to
send me a repro case, you might prefer to test with the CVS version of
OCaml, branch "release309": chances are that your problem will go away.

Best regards,

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Jul 18, 2006

Comment author: @xavierleroy

Fixed in 3.09 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants