
Hi, Am Montag, den 29.05.2017, 10:40 +0200 schrieb Sebastian Graf:
Note that at the bottom, there are RULEs stating the specialization for `Show Integer`, but that the specialized dictionary `$fShowRatio_$s$fShowRatio :: Show (Ratio Integer)` isn't otherwise reachable from any exported top- level identifier. Same goes for any of the specialized dictionary methods.
At least the Occurrence Analyzer keeps things referenced from RULES alive: initial_uds = addManyOccsSet emptyDetails (rulesFreeVars imp_rules `unionVarSet` vectsFreeVars vects `unionVarSet` vectVars) -- The RULES and VECTORISE declarations keep things alive! So maybe the isExportedId is not the full truths that we are looking for here… which would mean that CallArity might be buggy in that respect. This does not contradict Note [ExportFlag on binders] – these IDs do not need to be marked Exported, as they are kept alive by the RULE. Would we drop, for whatever reason, the RULE, we would drop the id.
In my case, my custom GHC would substitute away the `showString " % "` for an `absentError "lvl [Char]"` and crash in subtle ways. The only reason this isn't happening for GHC master is that DmdAnal does consider all top-level arguments to be used, instead of only the exported ones (which is what CallArity does).
It seems that CallArity is wrong here, and DmdAnal is right. The way out is probably to have CallArity take RULES properly into account. Greetings, Joachim -- Joachim “nomeata” Breitner mail@joachim-breitner.de • https://www.joachim-breitner.de/ XMPP: nomeata@joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org