• Ben Gamari's avatar
    Ensure DynFlags are consistent · eca9a1a1
    Ben Gamari authored
    While we have always had makeDynFlagsConsistent to enforce a variety of
    consistency invariants on DynFlags, it hasn't been widely used.
    GHC.Main, for instance, ignored it entirely. This leads to issues like
    Trac #10549, where an OPTIONS_GHC pragma introduced an inconsistency,
    leading to a perplexing crash later in compilation.
    
    Here I add consistency checks in GHC.Main.set{Session,Program}DynFlags,
    closing this hole.
    
    Fixes #10549.
    
    Test Plan: Validate with T10549
    
    Reviewers: austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1128
    
    GHC Trac Issues: #10549
    eca9a1a1
DynFlags.hs 175 KB