[GHC] #11270: "Unusable UNPACK pragma" warnings should be printed even without -O

#11270: "Unusable UNPACK pragma" warnings should be printed even without -O -------------------------------------+------------------------------------- Reporter: osa1 | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 7.11 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: -------------------------------------+------------------------------------- UNPACK pragmas are ignored when -O is not used, and this is very annoying when developing inside GHCi. Example: {{{ ➜ unpack_warning ghc-stage2 Main.hs -Wall -fforce-recomp --make [1 of 1] Compiling Main ( Main.hs, Main.o ) Linking Main ... }}} No warning printed even though I used {{{-Wall}}}. If I add {{{-O}}}: {{{ ➜ unpack_warning ghc-stage2 Main.hs -Wall -fforce-recomp --make -O [1 of 1] Compiling Main ( Main.hs, Main.o ) Main.hs:5:13: warning: • Ignoring unusable UNPACK pragma on the first argument of ‘Blah’ • In the definition of data constructor ‘Blah’ In the data type declaration for ‘Blah’ Linking Main ... }}} This is very annoying, because {{{-O}}} is ignored in GHCi: {{{ ➜ unpack_warning ghc-stage2 Main.hs -Wall -fforce-recomp -O --interactive when making flags consistent: warning: -O conflicts with --interactive; -O ignored. GHCi, version 7.11.20151220: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( Main.hs, interpreted ) Ok, modules loaded: Main. }}} So basically there's no way to get these warning in GHCi. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11270 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11270: "Unusable UNPACK pragma" warnings should be printed even without -O -------------------------------------+------------------------------------- Reporter: osa1 | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 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 simonpj): But in GHCi, which does not optimise, UNPACK pragmas do nothing, so it seems sensible to ignore them. Are you saying that you want GHC to do all the checks that it would have done if it had been optimising, even though it will then ignore the results? I'm sure that would be do-able if that's what everyone wants, and someone was willing to do it. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11270#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11270: "Unusable UNPACK pragma" warnings should be printed even without -O -------------------------------------+------------------------------------- Reporter: osa1 | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 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 osa1):
Are you saying that you want GHC to do all the checks that it would have done if it had been optimising, even though it will then ignore the results?
Yes! In my opinion -Wall should check for all the warnings, no matter which optimization setting is used. Why? Because in my experience, this happens a lot: Programs are developed with -O0 or a similar parameter that reduces compilation times, to be able to iterate faster. Then programs would be compiled with -O before distribution (or before testing etc.). Currently what happens is you develop a program using -O0, but just when you think you're done and you can move to the testing you start getting warnings. This is very annoying IMO. We can improve the warning messages by maybe saying something like: "Unusable UNPACK ... Note that UNPACK pragmas are only effective with -O or higher". (the second part is only printed in -O0) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11270#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11270: "Unusable UNPACK pragma" warnings should be printed even without -O -------------------------------------+------------------------------------- Reporter: osa1 | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 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 thomie): Don't make `-O0` slow please. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11270#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11270: "Unusable UNPACK pragma" warnings should be printed even without -O -------------------------------------+------------------------------------- Reporter: osa1 | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 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 rwbarton): There is a similar tension with `-fno-code` and incomplete pattern match warnings--or did that change with the new exhaustiveness checking in HEAD? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11270#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11270: "Unusable UNPACK pragma" warnings should be printed even without -O -------------------------------------+------------------------------------- Reporter: osa1 | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 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 osa1): @thomie, it shouldn't get any slower - all the information is already there. (unless we end up forcing a thunk that otherwise wouldn't be forced. Even in this case there shouldn't be any measurable difference, the code is not doing anything fancy) @rwbarton, good point. I just tried using HEAD: {{{ ➜ ghc-stage1 -fno-code -fforce-recomp -Wall --make Main.hs [1 of 1] Compiling Main ( Main.hs, nothing ) ➜ ghc-stage1 -fforce-recomp -Wall --make Main.hs [1 of 1] Compiling Main ( Main.hs, Main.o ) Main.hs:6:1: warning: Pattern match(es) are non-exhaustive In an equation for ‘showD’: Patterns not matched: C Linking Main ... }}} I think ideally this shouldn't happen, but we should probably discuss this further in the mailing list. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11270#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC