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

#14965: GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint fails -------------------------------------+------------------------------------- Reporter: blynn | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.1 Keywords: | Operating System: Linux Architecture: | Type of failure: Incorrect result Unknown/Multiple | at runtime Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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: {{{#!hs 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: {{{#!hs 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14965 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14965: GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint fails -------------------------------------+------------------------------------- Reporter: blynn | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.1 Resolution: | Keywords: Operating System: Linux | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by blynn): * Attachment "bug.hs" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14965 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14965: GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint fails -------------------------------------+------------------------------------- Reporter: blynn | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.1 Resolution: | Keywords: Operating System: Linux | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by blynn): * Attachment "Sep.hs" added. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14965 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14965: GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint fails -------------------------------------+------------------------------------- Reporter: blynn | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.1 Resolution: | Keywords: Operating System: Linux | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by blynn): * Attachment "corelint.dump" added. dump of -O -dcore-lint -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14965 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14965: GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint fails -------------------------------------+------------------------------------- Reporter: blynn | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.1 Resolution: | Keywords: Operating System: Linux | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by blynn): * cc: benlynn@… (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14965#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14965: GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint fails -------------------------------------+------------------------------------- Reporter: blynn | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.1 Resolution: | Keywords: DWARF Operating System: Linux | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: => DWARF Comment: Note that, AFAICT, this requires a build of GHC 8.4.1 with DWARF support to trigger. I cannot reproduce the bug on a DWARF-less 8.4.1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14965#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14965: GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint fails -------------------------------------+------------------------------------- Reporter: blynn | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.1 Resolution: | Keywords: DWARF Operating System: Linux | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Wow. How on earth could DWARF trigger a Core Lint error???!!! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14965#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14965: GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint fails -------------------------------------+------------------------------------- Reporter: blynn | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.1 Resolution: | Keywords: DWARF Operating System: Linux | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Actually I think it may be directly related to #14779, which is fixed in 8.4.2. The DWARF bit may be the 'ticks' which are floating around. The Lint error (in corelint.dump) relates to a top level literal string with a tick wrapped around it. It is still astonishing to me that we get different output though -- how on earth does that happen? Maybe it's because that tick wrapped around the literal string is confusing the code generator too. Does this all work right in 8.4.2? How you even build GHC "with DWARF support" or otherwise? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14965#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14965: GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint fails -------------------------------------+------------------------------------- Reporter: blynn | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.1 Resolution: | Keywords: DWARF Operating System: Linux | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: T14965 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): D4534 Wiki Page: | -------------------------------------+------------------------------------- Changes (by alpmestan): * testcase: => T14965 * differential: => D4534 Comment: Ben is adding the program from this ticket to the testsuite (CI is green presumably because we don't build (and test) the libraries with `-g3` in our CI scripts). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14965#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14965: GHC 8.4.1 bug: -O + separate compilation + three list fields +
concatenation; core-lint fails
-------------------------------------+-------------------------------------
Reporter: blynn | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.4.1
Resolution: | Keywords: DWARF
Operating System: Linux | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case: T14965
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): D4534
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#14965: GHC 8.4.1 bug: -O + separate compilation + three list fields + concatenation; core-lint fails -------------------------------------+------------------------------------- Reporter: blynn | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.2 Component: Compiler | Version: 8.4.1 Resolution: fixed | Keywords: DWARF Operating System: Linux | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: T14965 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4534 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * differential: D4534 => Phab:D4534 * resolution: => fixed * milestone: => 8.4.2 Comment: This is fixed in 8.4.2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14965#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC