Opened 8 years ago

Closed 8 years ago

Last modified 4 months ago

#4469 closed bug (fixed)

recompilation or build system bug

Reported by: igloo Owned by:
Priority: normal Milestone: 7.0.2
Component: Build System (make) Version: 6.12.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

First reported here: http://www.haskell.org/pipermail/cvs-ghc/2010-November/057293.html

If you add INLINE pragmas to fromInteger and toEnum for Word8 and run make in the ghc subdirectory, the build fails with:

"inplace/bin/ghc-stage1" -o ghc/stage2/build/tmp/ghc-stage2   -H32m -O -Wall  -H64m -O0     -i -ighc/. -ighc/stage2/build -ighc/stage2/build/autogen -Ighc/stage2/build -Ighc/stage2/build/autogen        -O2 -O -DGHCI -threaded -package ghc-7.1.20101102 -package haskeline -XCPP -XPatternGuards -XForeignFunctionInterface -XUnboxedTuples -XFlexibleInstances -XMagicHash -no-user-package-conf -rtsopts     -odir ghc/stage2/build -hidir ghc/stage2/build -stubdir ghc/stage2/build -hisuf hi -osuf  o -hcsuf hc  ghc/stage2/build/Main.o ghc/stage2/build/GhciMonad.o ghc/stage2/build/GhciTags.o ghc/stage2/build/InteractiveUI.o ghc/stage2/build/hschooks.o
/home/ian/ghc/darcs/ghc/libraries/utf8-string/dist-install/build/libHSutf8-string-0.3.6.a(String.o): In function `s1eq_info':
(.text+0x18d): undefined reference to `base_GHCziWord_zdwzdctoEnum4_info'
/home/ian/ghc/darcs/ghc/libraries/utf8-string/dist-install/build/libHSutf8-string-0.3.6.a(String.o): In function `r17C_closure':
(.data+0xc8): undefined reference to `base_GHCziWord_zdwzdctoEnum4_closure'
/home/ian/ghc/darcs/ghc/libraries/utf8-string/dist-install/build/libHSutf8-string-0.3.6.a(String.o): In function `r17M_closure':
(.data+0x208): undefined reference to `base_GHCziWord_zdwzdctoEnum4_closure'
/home/ian/ghc/darcs/ghc/libraries/base/dist-install/build/libHSbase-4.3.0.0.a(Types.o):(.data+0x3188): undefined reference to `base_GHCziWord_zdfBitsWord8zuzdcfromInteger_closure'
/home/ian/ghc/darcs/ghc/libraries/base/dist-install/build/libHSbase-4.3.0.0.a(Types.o):(.data+0x29b8): undefined reference to `base_GHCziWord_zdfBitsWord8zuzdcfromInteger_closure'
collect2: ld returned 1 exit status
make[2]: *** [ghc/stage2/build/tmp/ghc-stage2] Error 1
make[1]: *** [all_ghc] Error 2
make[1]: Leaving directory `/home/ian/ghc/darcs/ghc'
make: *** [all] Error 2
Codec.Binary.UTF8.String
    imports
Data.Word
    imports
GHC.Word

but when running make we got:

"inplace/bin/ghc-stage1" [...] libraries/base/./Data/Word.hs -o 
libraries/base/dist-install/build/Data/Word.o
compilation IS NOT required

and the timestamps show that String wasn't rebuilt:

14:49 libraries/base/dist-install/build/GHC/Word.o
14:49 libraries/base/dist-install/build/GHC/Word.hi
14:49 libraries/base/dist-install/build/Data/Word.o
12:33 libraries/base/dist-install/build/Data/Word.hi
12:34 libraries/utf8-string/dist-install/build/Codec/Binary/UTF8/String.o
12:34 libraries/utf8-string/dist-install/build/Codec/Binary/UTF8/String.hi

Change History (5)

comment:1 Changed 8 years ago by simonmar

Just to be sure there's no confusion, can you attach the exact diff of the change you made to GHC.Word?

It does look like a recompilation bug, and those are good to nail because they give rise to spurious failures and general annoyance. We rarely get to investigate them because the evidence disappears so easily.

comment:2 Changed 8 years ago by igloo

hunk ./GHC/Word.hs 216
     abs x                  = x
     signum 0               = 0
     signum _               = 1
+    {-# INLINE fromInteger #-}
     fromInteger i          = W8# (narrow8Word# (integerToWord i))
 
 instance Real Word8 where
hunk ./GHC/Word.hs 229
     pred x
         | x /= minBound = x - 1
         | otherwise     = predError "Word8"
+    {-# INLINE toEnum #-}
     toEnum i@(I# i#)
         | i >= 0 && i <= fromIntegral (maxBound::Word8)
                         = W8# (int2Word# i#)

comment:3 Changed 8 years ago by simonmar

Status: newmerge

Fixed. It was indeed a good bug to catch - probably led to real link errors in the wild.

Thu Dec  2 12:23:49 GMT 2010  Simon Marlow <marlowsd@gmail.com>
  * Fix a recomp bug: make classes/datatypes depend directly on DFuns (#4469)
  And remove the old mechanism of recording dfun uses separately,
  because it didn't work.
  
  This wiki page describes recompilation avoidance and fingerprinting.
  I'll update it to describe the new method and what went wrong with the
  old method:
  
  http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/RecompilationAvoidance

comment:4 Changed 8 years ago by igloo

Resolution: fixed
Status: mergeclosed

Merged.

comment:5 Changed 4 months ago by bgamari

Component: Build SystemBuild System (make)

The new Hadrian build system has been merged. Relabeling the tickets concerning the legacy make build system to prevent confusion.

Note: See TracTickets for help on using tickets.