Opened 5 years ago

Closed 5 years ago

#5475 closed bug (fixed)

Unthrown exceptions

Reported by: Owned by: igloo
Priority: high Milestone: 7.4.1
Component: Compiler Version: 7.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


With today's HEAD, I got five unexpected failures because some exceptions weren't thrown as they should've been:

   ../../libraries/stm/tests  stm060 [bad stdout] (hpc)
   codeGen/should_run         cgrun059 [bad exit code] (hpc,optasm,threaded2,dyn)

Change History (6)

comment:1 Changed 5 years ago by igloo

Milestone: 7.4.1
Owner: set to simonpj
Priority: normalhigh

Hmm, with q.hs:

module Main (main) where

main :: IO ()
main = do local <- testPackage
          case (local, False) of
               ([x], _)     -> putStrLn "X"
               (_,   True)  -> putStrLn "Y"
               ([],  False) -> error "A"
               (as,  bs)    -> error "B"
testPackage :: IO [Int]
testPackage = return []

and HEAD I get:

$ ghc -fforce-recomp -dcore-lint -dcmm-lint -O --make q
[1 of 1] Compiling Main             ( q.hs, q.o )
Linking q ...
$ ./q
$ echo $?

comment:2 Changed 5 years ago by igloo

(and expected q: A on stderr, and exit code 1)

comment:3 Changed 5 years ago by simonpj@…

commit b8abb31f649f0b3eeb691f92a8310b73c520658e

Author: Simon Peyton Jones <>
Date:   Wed Nov 9 21:56:50 2011 +0000

    Fix Trac #5475: another bug in exprArity
    As usual it was to do with the handling of bottoms,
    but this time it wasn't terribly subtle; I was using
    andArityType (which is designed for case branches) as
    a cheap short cut for the arity trimming needed with
    a cast.  That did the Wrong Thing for bottoming
    expressions.  Sigh.

 compiler/coreSyn/CoreArity.lhs    |   27 ++++++++++++++++-----------
 compiler/simplCore/SimplUtils.lhs |    2 +-
 2 files changed, 17 insertions(+), 12 deletions(-)

comment:4 Changed 5 years ago by simonpj

Owner: changed from simonpj to igloo

Nice bug thank you. I'm travelling with a slow laptop so I can't do a full validate, but I'm pretty sure this fix will be fine. Ian can you check?

Also can you add a regression test? I wasn't sure how to add one that expects a non-zero exit code. Moreover Windows prints "T5475.exe: A" whereas presumably Unix will not print the "exe" part. thanks


comment:5 Changed 5 years ago by

cgrun059 passes now all ways, stm060 passed already before.

comment:6 Changed 5 years ago by igloo

Resolution: fixed
Status: newclosed

passes here too, and cgrun059 already tests this bug, so no need to add a new testcase.

Note: See TracTickets for help on using tickets.