diff --git a/compiler/GHC/Iface/Recomp.hs b/compiler/GHC/Iface/Recomp.hs index e4a7a34b40bd35189deb7251abe3e1123f464d3e..56704c34d0a486cf9cc8a27f01e031fa16c45bbd 100644 --- a/compiler/GHC/Iface/Recomp.hs +++ b/compiler/GHC/Iface/Recomp.hs @@ -1301,18 +1301,14 @@ addFingerprints hsc_env iface0 -- The interface hash depends on: -- - the ABI hash, plus - -- - the source file hash, + -- - the things which can affect whether a module is recompiled -- - the module level annotations, - -- - usages -- - deps (home and external packages, dependent files) - -- - hpc iface_hash <- computeFingerprint putNameLiterally (mod_hash, - mi_src_hash iface0, ann_fn (mkVarOccFS (fsLit "module")), -- See mkIfaceAnnCache - mi_usages iface0, - sorted_deps, - mi_hpc iface0) + mi_self_recomp_info iface0, + sorted_deps ) let final_iface_exts = ModIfaceBackend diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo001/Makefile b/testsuite/tests/driver/dynamicToo/dynamicToo001/Makefile index ee0d464440d9a81b7add3bd1e7e836c499b991d5..2aa72e15cd076a80cddcc3cf6fe99abdfd79e040 100644 --- a/testsuite/tests/driver/dynamicToo/dynamicToo001/Makefile +++ b/testsuite/tests/driver/dynamicToo/dynamicToo001/Makefile @@ -48,4 +48,20 @@ dynamicToo001MakeB: cp B1.hs B.hs "$(TEST_HC)" $(TEST_HC_OPTS) -O C.hs -dynamic-too +.PHONY: T25837 +# Test that -dynamic-too notices when interface files were compiled with different flags +T25837: + # First compile without -dynamic but with -O0 + "$(TEST_HC)" $(TEST_HC_OPTS) -O0 -c T25837Module.hs + + # Then compile with -dynamic but with -ticky + "$(TEST_HC)" $(TEST_HC_OPTS) $(TEST_HC_OPTS_DYN) -ticky -c T25837Module.hs + + # Now try to compile with -dynamic-too, should detect the mismatch and recompile + "$(TEST_HC)" $(TEST_HC_OPTS) -v1 -dynamic-too --make T25837Module.hs + + # Verify that both interfaces now match (optional check) + $(call checkExists,T25837Module.hi) + $(call checkExists,T25837Module.dyn_hi) + diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo001/T25837.stdout b/testsuite/tests/driver/dynamicToo/dynamicToo001/T25837.stdout new file mode 100644 index 0000000000000000000000000000000000000000..096ff581deb6ad5ae865fae2f8790461d11203eb --- /dev/null +++ b/testsuite/tests/driver/dynamicToo/dynamicToo001/T25837.stdout @@ -0,0 +1 @@ +[1 of 1] Compiling T25837Module ( T25837Module.hs, T25837Module.o, T25837Module.dyn_o ) [Mismatched dynamic interface file] diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo001/T25837Module.hs b/testsuite/tests/driver/dynamicToo/dynamicToo001/T25837Module.hs new file mode 100644 index 0000000000000000000000000000000000000000..243b8f2194cf97555309fb356c6d112a9c7c86e6 --- /dev/null +++ b/testsuite/tests/driver/dynamicToo/dynamicToo001/T25837Module.hs @@ -0,0 +1,6 @@ +module T25837Module where + +data MyType = MyType Int + +myValue :: MyType +myValue = MyType 42 \ No newline at end of file diff --git a/testsuite/tests/driver/dynamicToo/dynamicToo001/test.T b/testsuite/tests/driver/dynamicToo/dynamicToo001/test.T index 2c9636bc89dada6c6fb223409b382a245b657b9f..58539df19ebf8c3b51c5f175e4694e4c540bf67b 100644 --- a/testsuite/tests/driver/dynamicToo/dynamicToo001/test.T +++ b/testsuite/tests/driver/dynamicToo/dynamicToo001/test.T @@ -5,3 +5,4 @@ opts = [ extra_files(['A.hs', 'B1.hs', 'B2.hs', 'C.hs']), test('dynamicToo001', [opts], makefile_test, []) test('dynamicToo001MakeA', [opts], makefile_test, []) test('dynamicToo001MakeB', [opts], makefile_test, []) +test('T25837', [opts], makefile_test, [])