Ticket #457 (new bug: None)

Opened 8 years ago

Last modified 3 years ago

Strictness problem

Reported by: nilsanders Owned by:
Priority: normal Milestone: _|_
Component: Compiler Version: 6.4.1
Keywords: Cc: michal.terepeta@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by simonmar) (diff)

As requested, this is a resubmission (and update) of a
previously reported bug, to get it into the bug tracker.

The following program should output something involving
Correct:

> module Main where

> f x = case x of
>   x@True  -> \y -> x && y
>   x@False -> \y -> x && y

> main = putStrLn $ f (error "Correct") `seq` "Error"

However, whether it does so is a non-trivial function
of the GHC version and optimisation settings:

GHC version     -O2?  Correct?
------------------------------
4.08.1          No    Yes
4.08.1          Yes   No
5.04.2          No    No
5.04.2          Yes   Yes
6.0.1           _     No
6.2.2           _     No
6.4             _     No
6.4.1.20050820  _     No

All tests were run on a Solaris system.

Different fs give different behaviour, at least for
6.0.1. Try e.g.

> f x = case x of
>   True  -> id
>   False -> id

Change History

  Changed 7 years ago by simonmar

  • version changed from None to 6.4.1
  • description modified (diff)
  • severity changed from normal to minor

  Changed 7 years ago by simonpj

  • owner changed from nobody to simonpj
  • difficulty set to Unknown
  • status changed from assigned to new
  • os set to Unknown
  • architecture set to Unknown

Related to #317.

Caused by the fact that we eta-expand around the case expression. Not eta-expanding hurts performance in important cases (we think). Still thinking what to do about this; it's technically wrong but seldom seems to bite in practice.

Simon

  Changed 7 years ago by simonmar

See also #826

  Changed 6 years ago by igloo

  • milestone set to 6.8

This is still wrong in 6.6 and the HEAD.

  Changed 6 years ago by guest

  Changed 6 years ago by simonmar

  • owner simonpj deleted
  • milestone changed from 6.8 branch to _|_

  Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

  Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple

follow-up: ↓ 10   Changed 3 years ago by igloo

  • failure set to Incorrect result at runtime

Still happens in 6.12.

in reply to: ↑ 9   Changed 3 years ago by michalt

  • cc michal.terepeta@… added

Replying to igloo:

Still happens in 6.12.

Current HEAD (7.1.20101015):

  • without optimisations - correct
  • with -O or -O2 - error
Note: See TracTickets for help on using tickets.