#2169: Compilation fails first time without giving an error, later succeeds
without changing code
----------------------+-----------------------------------------------------
 Reporter:  nccb      |          Owner:                
     Type:  bug       |         Status:  new           
 Priority:  normal    |      Milestone:  6.10.1        
Component:  Compiler  |        Version:  6.8.2         
 Severity:  normal    |     Resolution:                
 Keywords:            |     Difficulty:  Unknown       
 Testcase:            |   Architecture:  x86_64 (amd64)
       Os:  Linux     |  
----------------------+-----------------------------------------------------
Changes (by igloo):

  * milestone:  _|_ => 6.10.1

Comment:

 Here's `main/HeaderInfo.hs:getOptionsFromFile` with some extra debugging
 prints:
 {{{
 getOptionsFromFile :: DynFlags
                    -> FilePath            -- input file
                    -> IO [Located String] -- options, if any
 getOptionsFromFile dflags filename
     = Control.Exception.bracket
           (openBinaryFile filename ReadMode)
               (hClose)
               (\handle ->
                    do buf <- hGetStringBufferBlock handle blockSize
                       opts <- loop handle buf
                       if showSDoc (ppr opts) == "[[-, X, C, P, P], [-, f,
 v, e, c, t, o, r, i, s, e]]"
                           then do print ("B4", filename)
                                   print ("B5", lexemeToString buf (len
 buf))
                                   putStrLn "B6"
                           else return ()
                       return opts)
     where blockSize = 1024
           loop handle buf
               | len buf == 0 = return []
               | otherwise
               = do
                  -- print ("B1", lexemeToString buf (len buf))
                  case getOptions' dflags buf filename of
                   (Nothing, opts) ->
                       do print ("B2", showSDoc (ppr opts))
                          return opts
                   (Just buf', opts) -> do print ("B3", showSDoc (ppr
 opts))
                                           nextBlock <-
 hGetStringBufferBlock handle blockSize
                                           newBuf <- appendStringBuffers
 buf' nextBlock
                                           if len newBuf == len buf
                                              then return opts
                                              else do opts' <- loop handle
 newBuf
                                                      return (opts++opts')
 }}}
 and here's some output while compiling dph:
 {{{
 V2
 ("B3","[[-, X, C, P, P]]")
 ("B2","[[-, f, v, e, c, t, o, r, i, s, e]]")
 ("B4","./Data/Array/Parallel/Lifted/PArray.hs")
 ("B5","{-# LANGUAGE CPP #-}{-# OPTIONS -fvectorise #-}\nmodule
 Data.Array.Parallel.Prelude.Int (\n  P.Int, (+), (-), (*), div, mod,
 intSquareRoot, enumFromToP, intSumP, \n  (==), (/=), (<=), (<), (>=),
 (>)\n) where\n\nimport Data.Array.Parallel.Prelude.Base\nimport
 Data.Array.Parallel.Prelude.Base.Int\n\nimport qualified Prelude as
 P\nimport Prelude (Int)\n\ninfixl 7 *\ninfixl 6 +, -\ninfix 4 ==, /=, <,
 <=, >, >=\n\n(==), (/=), (<), (<=), (>), (>=) :: Int -> Int ->
 P.Bool\n(==) = eq\n(/=) = neq\n(<) = lt\n(<=) = le\n(>) = gt\n(>=) =
 ge\n\n(*) :: Int -> Int -> Int\n(*) = mult\n\n(+) :: Int -> Int ->
 Int\n(+) = plus\n\n(-) :: Int -> Int -> Int\n(-) = minus\n\ndiv:: Int ->
 Int -> Int\ndiv = intDiv\n\nmod:: Int -> Int -> Int\nmod =
 [EMAIL 
PROTECTED]|\STX\NUL\NUL\NUL\NUL\NUL\NUL|1\NUL\STX+\NUL\NULI\NUL+\NUL\STX+\NUL\NUL\NUL\NUL!\NUL\STX+\NUL\NUL\NUL\802\NUL\NUL\NUL\NUL\NULk#\NUL\STX+\NUL\NUL\EOT\NUL\NUL\NUL\NUL\NUL\NUL\NUL\NUL\STX\NUL\NUL\NUL\NUL\NUL\NUL\NUL\738\NUL\NUL\NUL\NUL\NULk#\NUL\STX+\NUL\NUL\EOT\NUL\NUL\NUL\NUL\NUL\NUL\NUL|\STX\NUL\NUL\NUL\NUL\NUL\NUL}\STX\NUL\NUL\NUL\NUL\NUL\NUL\NUL1\NUL\STX+\NUL\NUL\NULy\NUL\SOH\NUL\NUL\NUL\NUL\NUL\NUL!\NUL\STX+\NUL\NUL\NULh1\NUL\STX+\NUL\NUL9z\NUL\SOH\NUL\NUL\NUL\NUL\NUL\NUL!\NUL\STX+\NUL\NUL)J1\NUL\STX+\NUL\NUL\NULw\NUL\SOH\NUL\NUL\NUL\NUL\NUL\NUL!\NUL")
 B6
 }}}
 So we've tried to read `Data/Array/Parallel/Lifted/PArray.hs` but instead
 we have got `{-# LANGUAGE CPP #-}` followed by the contents of
 `Data/Array/Parallel/Prelude/Int.hs`.

 We don't know quite what's going on yet, but we're closer now, so I'm
 optimistically putting this bug back into the 6.10.1 milestone.

 I think it's likely that #2240 is caused by the same thing.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2169#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to