Opened 3 years ago

Closed 2 years ago

#5475 closed bug (fixed)

Unthrown exceptions

Reported by: daniel.is.fischer 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 Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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 2 years ago by igloo

  • Milestone set to 7.4.1
  • Owner set to simonpj
  • Priority changed from normal to high

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 $?
0

comment:2 Changed 2 years ago by igloo

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

comment:3 Changed 2 years ago by simonpj@…

commit b8abb31f649f0b3eeb691f92a8310b73c520658e

Author: Simon Peyton Jones <simonpj@microsoft.com>
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 2 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

Simon

comment:5 Changed 2 years ago by daniel.is.fischer

cgrun059 passes now all ways, stm060 passed already before.

comment:6 Changed 2 years ago by igloo

  • Resolution set to fixed
  • Status changed from new to closed

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.