-keep-tmp-files doesn't work when specified in OPTIONS_GHC pragma
If I specify -keep-tmp-files
in an OPTIONS_GHC pragma then the files local to that module are still deleted.
{-# OPTIONS_GHC -keep-tmp-files -finfo-table-map #-}
module A where
*** Assembler:
/nix/store/k04h29hz6qs45pn0mzaqbyca63lrz2s0-gcc-wrapper-11.3.0/bin/cc -iquote. -fno-PIC -x assembler -c /tmp/ghc3932039_0/ghc_1.s -o A.o.tmp
!!! systool:as: finished in 0.20 milliseconds, allocated 0.110 megabytes
Upsweep completely successful.
*** Deleting temp files:
Deleting: /tmp/ghc3932039_0/ghc_1.s /tmp/ghc3932039_0/ghc_2.c
Warning: deleting non-existent /tmp/ghc3932039_0/ghc_2.c
If I pass -keep-tmp-files
at the top level then the files are kept.
I think the problem is this call to deleting temp files, which doesn't take into account the local DynFlags. https://gitlab.haskell.org/ghc/ghc/-/blob/master/compiler/GHC/Driver/Make.hs#L784