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

When compiled with msvc64 toolchain Unix.create_process causes 'Segmentation fault'. #7422

Closed
vicuna opened this issue Nov 27, 2016 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Nov 27, 2016

Original bug ID: 7422
Reporter: applause
Assigned to: @dra27
Status: resolved (set by @gasche on 2016-11-27T20:25:15Z)
Resolution: fixed
Priority: urgent
Severity: major
Platform: amd64
OS: Windows 10
OS Version: 10.0.14393
Version: 4.04.0
Fixed in version: 4.05.0 +dev/beta1/beta2/beta3/rc1
Category: platform support (windows, cross-compilation, etc)

Bug description

Source file otherlibs/win32unix/createprocess.c needs '#define CAML_INTERNALS'
to be properly compiled for amd64 with MSVC.

Without CAML_INTERNALS defined this next line gives the following warning.

exefile = search_exe_in_path(String_val(cmd));
createprocess.c(37): warning C4047: '=': 'char *' differs in levels of indirection from 'int'
And this one is critical.

Confirmed with Visual Studio 2013 and 2015.

Steps to reproduce

Programs which use Unix.create_process will always fail.
Maybe ocamlfind.exe of findlib is handy for checking.

Additional information

Here are quotes from disassemble list of win_create_process_native(),
both good and wrong.

Good:
0000000000018324: E8 68 97 FF FF call @ilt+2700(caml_search_exe_in_path)
0000000000018329: 45 33 FF xor r15d,r15d
000000000001832C: 48 8B D8 mov rbx,rax

Wrong:
0000000000055C24: E8 5E BE FB FF call @ilt+2690(caml_search_exe_in_path)
0000000000055C29: 45 33 FF xor r15d,r15d
0000000000055C2C: 48 63 D8 movsxd rbx,eax

@vicuna
Copy link
Author

vicuna commented Nov 27, 2016

Comment author: @gasche

The bug (which only affects 4.04, not previous releases) has been noticed two weeks ago and is fixed in the 4.04 release branch, so it should be part of the next bugfix release:
#912

Note that the 4.04 release branch should be buildable and installable at any time -- so if you could install OCaml from sources you could easily get a fixed version.

Thanks for reporting! This reminds me that the issue should be more widely announced to our Windows users, I will write to the caml-list about it.

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