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

Linker error when functor body contains constant false assertion #7654

Closed
vicuna opened this Issue Oct 7, 2017 · 5 comments

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

commented Oct 7, 2017

Original bug ID: 7654
Reporter: bcc32
Status: resolved (set by @xavierleroy on 2017-10-07T15:20:04Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.04.2
Fixed in version: 4.05.0
Category: compiler driver
Monitored by: @alainfrisch

Bug description

Consider the following code:

module Make (Int : sig val one : int end) = struct
  let () = assert false
  let two () = [Int.one + 1]
end

module M = Make (struct let one = 1 end)

let _ = M.two ()

I get a linker error compiling this code using the native-code compiler.

Steps to reproduce

Compile with: ocamlopt test.ml

Additional information

Expanded example here: https://gist.github.com/bcc32/e6f3aa69443ea253a6a0719c2748d2e1

Compiler error output follows:

Undefined symbols for architecture x86_64:
"_camlTest__two_1202", referenced from:
_camlTest__entry in test.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
File "caml_startup", line 1:
Error: Error during linking

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 7, 2017

Comment author: bcc32

I forgot to mention, this issue is resolved in 4.05.0, but appears in at least 4.04.2 and 4.03.0.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 7, 2017

Comment author: @xavierleroy

Indeed this problem can't be reproduced in 4.05.0 nor in 4.06.0beta1. I think it is related to this series of bug fixes and improvements that went into 4.05: #983

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 7, 2017

Comment author: @xavierleroy

Maybe Alain Frisch (author of #983) can confirm this problem is gone for good with #983. In the meantime I mark it as resolved/fixed.

@vicuna vicuna closed this Oct 7, 2017

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 7, 2017

Comment author: @gasche

In fact the problem was fixed by Mark Shinwell in #959, which describes precisely this issue:

#959

(I didn't remember it but found it by bisection.)

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Oct 7, 2017

Comment author: bcc32

Ah, seems to be exactly right! Thanks for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.