Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,393
    • Issues 4,393
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 378
    • Merge Requests 378
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #14965

Closed
Open
Opened Mar 23, 2018 by blynn@trac-blynn

GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint fails

A simple program that works in 8.2.1 fails in 8.4.1 when compiled with -O. (Sorry, haven't tested 8.2.2.) GHC with -dcore-lint reports an error.

See attached files. In one file I declared:

module Sep where

data Sep = Sep
  { bugVanishesWithoutThis :: [()]
  , middle :: [String]
  , orThis :: [()]
  }

catSep :: Sep -> Sep -> Sep
catSep (Sep a b c) (Sep x y z) = Sep (a ++ x) (b ++ y) (c ++ z)

cc :: Sep -> Bool
cc boost = elem "foo" $ middle boost

and in a second file, simple code fails when compiled with -O:

module Main (main) where

import Sep

main :: IO ()
main = print $ cc bb

bb :: Sep
bb = catSep b1 b2

b1 :: Sep
b1 = Sep [] ["foo"] []

b2 :: Sep
b2 = Sep [] ["bar"] []

This should print "True", and does so for GHC 8.2.1, and GHC 8.4.1 without -O, but prints "False" for GHC 8.4.1 with -O.

I was unable to reproduce the bug with a single file.

Trac metadata
Trac field Value
Version 8.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC ben@dfinity.org
Operating system
Architecture
Assignee
Assign to
8.4.2
Milestone
8.4.2 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#14965