[GHC] #13269: Changes in includes of addCStub do not cause recompilation of downstream modules. (was: Changes in includes of `addCStub` do not cause recompilation of downstream modules.)

GHC ghc-devs at haskell.org
Sat Feb 11 14:41:52 UTC 2017


#13269: Changes in includes of addCStub do not cause recompilation of downstream
modules.
-------------------------------------+-------------------------------------
        Reporter:                    |                Owner:
  facundo.dominguez                  |
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.0.1
      Resolution:                    |             Keywords:  inline-c
                                     |  addCStub
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  13237             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by facundo.dominguez:

@@ -63,1 +63,1 @@
- Recompiling we can see that `B.hs` is not rebuilt. And executing the
+ Recompiling we can see that `B.hs` is not rebuilt and executing the

New description:

 Failing example:
 {{{
 // header.h
 #include <stdio.h>

 int f(int  x) {
     printf("calling f(%d)\n",x);
     return x + 1;
 }
 }}}

 {{{
 -- A.hs
 {-# LANGUAGE ForeignFunctionInterface #-}
 {-# LANGUAGE TemplateHaskell #-}

 module A where

 import Language.Haskell.TH.Syntax

 foreign import ccall f :: Int -> IO Int

 do addCStub "#include \"header.h\""
    addDependentFile "header.h"
    return []
 }}}
 {{{
 -- B.hs
 {-# LANGUAGE ForeignFunctionInterface #-}
 {-# LANGUAGE TemplateHaskell #-}

 module Main where

 import Language.Haskell.TH.Syntax
 import A

 do i <- runIO $ f 0
    [d| fh = i |]

 main :: IO ()
 main = print fh
 }}}
 {{{
 $ ghc --make B.hs
 [1 of 2] Compiling A                ( A.hs, A.o )
 [2 of 2] Compiling Main             ( B.hs, B.o )
 calling f(0)
 Linking B ...
 $ ./B
 1
 }}}
 Edit `header.h`:
 {{{
  // header.h
  #include <stdio.h>

  int f(int  x) {
      printf("calling f(%d)\n",x);
 -    return x + 1;
 +    return x + 2;
  }
 }}}
 Recompiling we can see that `B.hs` is not rebuilt and executing the
 program still shows the old result.
 {{{
 $ ghc --make B.hs
 [1 of 2] Compiling A                ( A.hs, A.o ) [header.h changed]
 Linking B ...
 $ ./B
 1
 }}}

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13269#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list