[GHC] #12135: Failure to recompile when #include file is created earlier on include path

#12135: Failure to recompile when #include file is created earlier on include path -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Originally discovered when trying to improve Hadrian, for context see: https://github.com/snowleopard/hadrian/issues/247#issuecomment-222317602 If you create a file {{{Test.hs}}} {{{#!hs #include "a/Test.hs" main = print message }}} And a file {{{a/Test.h}}} {{{#!hs message = 1 }}} Then run and compile with {{{ghc --make -XCPP -Ib;a Main.hs}}} it compiles and runs properly, printing 1. Changing {{{a/Test.h}}} to {{{message = 2}}} then running {{{ghc}}} rebuilds and prints 2. Creating a fresh {{{b/Test.h}}} with {{{message = 3}}} does not cause {{{ghc}}} to recompile, and thus incorrectly still prints 2. Touching {{{Main.hs}}} causes recompilation, and then the correct header file is picked up, resulting in 3 being printed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12135 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12135: Failure to recompile when #include file is created earlier on include path -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Driver | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * component: Compiler => Driver @@ -4,1 +4,1 @@ - If you create a file {{{Test.hs}}} + If you create a file {{{Main.hs}}} @@ -7,1 +7,1 @@ - #include "a/Test.hs" + #include "Test.h" @@ -17,4 +17,4 @@ - Then run and compile with {{{ghc --make -XCPP -Ib;a Main.hs}}} it compiles - and runs properly, printing 1. Changing {{{a/Test.h}}} to {{{message = - 2}}} then running {{{ghc}}} rebuilds and prints 2. Creating a fresh - {{{b/Test.h}}} with {{{message = 3}}} does not cause {{{ghc}}} to + Then run and compile with {{{ghc --make -XCPP -Ib -Ia Main.hs}}} it + compiles and runs properly, printing 1. Changing {{{a/Test.h}}} to + {{{message = 2}}} then running {{{ghc}}} rebuilds and prints 2. Creating a + fresh {{{b/Test.h}}} with {{{message = 3}}} does not cause {{{ghc}}} to New description: Originally discovered when trying to improve Hadrian, for context see: https://github.com/snowleopard/hadrian/issues/247#issuecomment-222317602 If you create a file {{{Main.hs}}} {{{#!hs #include "Test.h" main = print message }}} And a file {{{a/Test.h}}} {{{#!hs message = 1 }}} Then run and compile with {{{ghc --make -XCPP -Ib -Ia Main.hs}}} it compiles and runs properly, printing 1. Changing {{{a/Test.h}}} to {{{message = 2}}} then running {{{ghc}}} rebuilds and prints 2. Creating a fresh {{{b/Test.h}}} with {{{message = 3}}} does not cause {{{ghc}}} to recompile, and thus incorrectly still prints 2. Touching {{{Main.hs}}} causes recompilation, and then the correct header file is picked up, resulting in 3 being printed. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12135#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12135: Failure to recompile when #include file is created earlier on include path
-------------------------------------+-------------------------------------
Reporter: NeilMitchell | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Driver | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Edward Z. Yang

#12135: Failure to recompile when #include file is created earlier on include path -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Driver | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by ezyang): * owner: => ezyang Comment: Fix is easy: we need to track files which are expected to be non-existent; starting with `hpm_src_files` all the way to `mi_usages`. I'll do a patch. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12135#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12135: Failure to recompile when #include file is created earlier on include path -------------------------------------+------------------------------------- Reporter: NeilMitchell | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Driver | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by ezyang): * owner: ezyang => Comment: It's unclear how to get the preprocessor to divulge what paths were searched. However, if we can get this information, then it should be relatively easy to track file non-existence in usages. The recipe for getting the preprocessor to produce this information is of general interest; I've filed a bug with Shake to see if there's a good way to get the info out of `cpp`: https://github.com/ndmitchell/shake/issues/463 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12135#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC