[ ghc-Bugs-1309795 ] Control.Exception.assert broken with -O

SourceForge.net noreply at sourceforge.net
Fri Sep 30 17:20:42 EDT 2005


Bugs item #1309795, was opened at 2005-09-30 14:20
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1309795&group_id=8032

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libraries/base
Group: 6.4.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Fergus Henderson (fergus)
Assigned to: Nobody/Anonymous (nobody)
Summary: Control.Exception.assert broken with -O

Initial Comment:
According to the ghc documentation
(section 4.9 "optimization" and section 7.8 "assertions" in
the user guide, and the documentation for Control.Exception
in the hierarchical libraries guide),
assertions should be checked unless explicitly disabled
with
"-fignore-asserts", and the "-O" option should have no
effect on them.

But in ghc version 6.4.1.20050801, "-O" seems to also
have the
effect of disabling assertions:

   bash$ cat Test.hs
   import Control.Exception
   main = print (assert False (42::Int))

   bash$ ghc -O Test.hs && ./a.out
   42

This undocumented behaviour is an egregious violation
of the
principle of least surprise.





----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1309795&group_id=8032



More information about the Glasgow-haskell-bugs mailing list