Ticket #936 (closed merge: fixed)

Opened 2 years ago

Last modified 2 years ago

strange ghci behavior and error with recursive modules

Reported by: Misha Aizatulin <avatar@hot.ee> Assigned to: igloo
Priority: normal Milestone: 6.6.1
Component: GHCi Version: 6.4.2
Severity: normal Keywords:
Cc: avatar@hot.ee Difficulty: Unknown
Test Case: ghci.prog007 Architecture: Unknown
Operating System: Linux

Description

Here is a ghci session with the attached program:

> ghci B
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.4.2, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base-1.0 ... linking ... done.
Compiling C[boot]          ( ./C.hs-boot, ./C.o-boot )
Compiling A                ( ./A.hs, interpreted )
Compiling B                ( B.hs, interpreted )
Compiling C                ( ./C.hs, interpreted )
Ok, modules loaded: C, B, A, C.
*C> :r
Ok, modules loaded: A, C, B.
*A> :m + B
*A B> A

During interactive linking, GHCi couldn't find the following symbol:
  B_zdfClass1B_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session.  Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please send a bug report to:
  glasgow-haskell-bugs@haskell.org

*A B> B
B
*A B> A
A

3 strange things happen: 1. I ask to load B, it loads C 2. I ask to reload, it loads A :) 3. missing symbol error which goes away after evaluating some other expression

Attachments

ghci_symbol.tar.gz (424 bytes) - added by giksos on 10/12/06 15:32:12.

Change History

10/12/06 15:32:12 changed by giksos

  • attachment ghci_symbol.tar.gz added.

01/26/07 11:33:16 changed by igloo

  • testcase changed.
  • milestone set to 6.6.1.

All but 3) looks fixed in 6.6 and the HEAD. The message now talks about B_zdf1_closure, but is otherwise the same.

01/29/07 08:44:23 changed by simonmar

I looked into this a bit. The problem seems to be that when the linker comes to link the expression 'A', it traverses the dependencies graph and doesn't find module B. The reason is that the dependencies for module A say C[boot], and don't include B, despite the fact that C depends on B (module dependencies are transitively closed, except for [boot] dependencies).

Perhaps we need to recursively add dependencies for [boot] modules that we find? (see compiler\ghci\Linker.hs:get_deps).

01/30/07 02:15:11 changed by simonmar

  • testcase set to ghci.prog007.
  • owner set to igloo.
  • type changed from bug to merge.

Fixed, please merge:

Tue Jan 30 02:13:06 PST 2007  Simon Marlow <simonmar@microsoft.com>
  * Fix for #936

and testsuite:

Tue Jan 30 02:10:59 PST 2007  Simon Marlow <simonmar@microsoft.com>
  * add test for bug #036

01/30/07 17:16:49 changed by igloo

  • status changed from new to closed.
  • resolution set to fixed.

Merged.