
#14659: assertions are turned off if -O2 comes after -fno-ignore-asserts -------------------------------------+------------------------------------- Reporter: mwotton | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 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: -------------------------------------+------------------------------------- test.hs: {{{#!hs import Control.Exception main = assert False (return ()) }}} ➜ ~ rm test; rm test.o; stack ghc -- -fno-ignore-asserts -O2 test.hs; ./test && echo $? [1 of 1] Compiling Main ( test.hs, test.o ) Linking test ... 0 ➜ ~ rm test; rm test.o; stack ghc -- -O2 -fno-ignore-asserts test.hs; ./test && echo $? [1 of 1] Compiling Main ( test.hs, test.o ) Linking test ... test: Assertion failed CallStack (from HasCallStack): assert, called at test.hs:3:8 in main:Main ``` tested with ghc 8.0.2 and 8.2.2. would have expected -fno-ignore-asserts to override -O2, no matter where it is in the options list. https://twitter.com/AlecMuffett/status/950699975767482370 shows how dangerous this could be. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14659 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler