Opened 7 years ago

Closed 7 years ago

#7585 closed bug (fixed)

Core lint failure when optimizing coercions in branched axioms

Reported by: goldfire Owned by: goldfire
Priority: normal Milestone:
Component: Compiler Version: 7.7
Keywords: TypeFamilies Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


The attached code causes the failure.

Core Lint correctly checks branched axioms for internal consistency -- when using branch n of an axiom, we must ensure that no branch m < n can possibly apply, no matter what the instantiation for any type variables in the branch may be. However, the coercion optimizer does not respect this property. It will replace coercions used in axioms with equivalent coercions that do not respect this internal consistency property. Everything works out OK in the end (without -dcore-lint, the file compiles and runs correctly), but we go through an invalid state on the way.

In particular, the TrPushAx rules are to blame.

I'm not sure what the best fix for this is, but it seems to be my job to find it.

Attachments (1)

Bug.hs (540 bytes) - added by goldfire 7 years ago.
triggers the bug

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by goldfire

Attachment: Bug.hs added

triggers the bug

comment:1 Changed 7 years ago by eir@…

commit a6ab0a40ac750914640613c77148e948fabf35d5

Author: Richard Eisenberg <>
Date:   Tue Jan 15 17:19:37 2013 -0500

    Fix Trac #7585.
    The coercion optimizer was optimizing coercions inside of branched
    axiom applications, sometimes invalidating the branch choice within
    the axiom application. Now, we check to make sure we are not
    invalidating this invariant before proceeding with the optimization.

 compiler/coreSyn/CoreLint.lhs  |   41 +------------------
 compiler/types/OptCoercion.lhs |   88 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 79 insertions(+), 50 deletions(-)

comment:2 Changed 7 years ago by goldfire

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.