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

SourceForge.net noreply at sourceforge.net
Wed Oct 5 09:13:23 EDT 2005


Bugs item #1309795, was opened at 2005-09-30 21:20
Message generated for change (Comment added) made by simonmar
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: Closed
>Resolution: Fixed
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.





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

>Comment By: Simon Marlow (simonmar)
Date: 2005-10-05 13:13

Message:
Logged In: YES 
user_id=48280

The documentation does actually mention that
-fignore-asserts is turned on by -O (section 4.9.2), but
section 7.8 doesn't make any mention of it.  I've now fixed
this.  Thanks for the report.

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

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