Weird porting problem with read

Matt Chapman matthewc@cse.unsw.edu.au
Sun, 5 May 2002 18:09:44 +1000


Background:  I'm working on porting GHC to IA64.  I have the initial
unregisterised port mostly working, except for a weird problem related
to this innocent bit of code (ghc/compiler/main/CmdLineOpts.hs):

opt_HiVersion = read (cProjectVersionInt ++ cProjectPatchLevel) :: Int

where:

cProjectVersionInt    = "503"
cProjectPatchLevel    = "0"

I get...

ghc-5.03: panic! (the `impossible' happened, GHC version 5.03):
        Prelude.read: no parse

Possibly of relevance is that cProjectVersionInt is built using
unpackCStringList#, whereas cProjectPatchLevel was generated statically.

Below I've included an ASCII art depiction of the closure that is passed
to read, after evaluation (i.e. I breakpointed after the parse error).
It looks feasibly correct to me, although I may be missing something.

Does anyone have any hints on where to proceed from here?

Matt


                 CmdLineOpts_lvl42_closure
                   IND_STATIC(0x504af380)
                              |
                      IND(0x504af418)
                              |
CONSTR(GHC.Base_C_con_info(tag=1), 0x504af3d8, 0x504af400)
                                       |           |
      CONSTR(GHC.Base_C#_con_info(tag=0), 0x35#)   |
                              _____________________|
                              |
                      IND(0x504b0018)
                              |
CONSTR(GHC.Base_C_con_info(tag=1), 0x504affc8, 0x504b0000)
                                       |           |
      CONSTR(GHC.Base_C#_con_info(tag=0), 0x30#)   |
                              _____________________|
                              |
                      IND(0x504b09f0)
                              |
CONSTR(GHC.Base_C_con_info(tag=1), 0x504b09b0, 0x504b09d8)
                                       |           |
      CONSTR(GHC.Base_C#_con_info(tag=0), 0x33#)   |
                              _____________________|
                              |
             IND(Config_cProjectPatchLevel_closure)
                              |
CONSTR(GHC.Base_C_static_info(tag=1), Config_a_closure, GHC.Base_[]_closure)
                                       |                |
     CONSTR(GHC.Base_C#_static_info(tag=0), 0x30#)      |
                              __________________________|
                              |
            CONSTR(GHC.Base_[]_static_info(tag=0))