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,309
    • Issues 4,309
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 383
    • Merge Requests 383
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #4945

Closed
Open
Opened Feb 03, 2011 by batterseapower@trac-batterseapower

Another SpecConstr infelicity

I'm beginning to sound like a broken record, but SpecConstr still doesn't seem to be right! The last problem has been fixed, but I've found a new one.

Please observe the output of compiling the attached code with:

./ghc -fforce-recomp -c -dverbose-core2core -O2 -fno-liberate-case STUArray-Rewrite2.hs

In the output of SpecConstr we have a local letrec:

(letrec {
   $wa_s1G7 [Occ=LoopBreaker]
     :: forall s_aJm.
        Data.Array.Base.STUArray
          s_aJm GHC.Types.Int GHC.Types.Int
        -> GHC.Prim.Int#
        -> GHC.Prim.State# s_aJm
        -> (# GHC.Prim.State# s_aJm, () #)
   [LclId, Arity=3, Str=DmdType LLL]
   $wa_s1G7 =
     \ (@ s_aJm)
       (w_s1FS
          :: Data.Array.Base.STUArray
               s_aJm GHC.Types.Int GHC.Types.Int)
       (ww_s1FV :: GHC.Prim.Int#)
       (w_s1FX :: GHC.Prim.State# s_aJm) ->
       case GHC.Prim.># ww_s1FV ww_s1FN
       of wild_Xj [Dmd=Just A] {
         GHC.Types.False ->
           case w_s1FS
           of wild_aTj [Dmd=Just L]
           { Data.Array.Base.STUArray ds1_aTl [Dmd=Just U]
                                      ds2_aTm [Dmd=Just U]
                                      n_aTn [Dmd=Just U(L)]
                                      ds3_aTo [Dmd=Just A] ->
           case n_aTn
           of wild_aTs [Dmd=Just A]
           { GHC.Types.I# x_aTu [Dmd=Just L] ->
           case $wa_s1G0
                  @ s_aJm
                  w_s1FS
                  (GHC.Types.I# ww_s1FV)
                  0
                  (GHC.Prim.-# x_aTu 1)
                  w_s1FX
           of wild_XUw [Dmd=Just A]
           { (# new_s_XUB [Dmd=Just L], r_XUD [Dmd=Just A] #) ->
           $wa_s1G7
             @ s_aJm w_s1FS (GHC.Prim.+# ww_s1FV 1) new_s_XUB
           }
           }
           };
         GHC.Types.True -> (# w_s1FX, GHC.Unit.() #)
       }; } in
 $wa_s1G7)

This is a local recursive loop with an invariant first argument (w_s1FS) that is recrutinised every time! This seems deeply uncool.

This is with HEAD (7.1.20110203, incorporating the patch "Fix typo in SpecConstr that made it not work at all")

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