Skip to content
  • John Ericson's avatar
    Fix #19931 · e8f7734d
    John Ericson authored
    The issue was the renderer for x86 addressing modes assumes native size
    registers, but we were passing in a possibly-smaller index in
    conjunction with a native-sized base pointer.
    
    The easist thing to do is just extend the register first.
    
    I also changed the other NGC backends implementing jump tables
    accordingly. On one hand, I think PowerPC and Sparc don't have the small
    sub-registers anyways so there is less to worry about. On the other
    hand, to the extent that's true the zero extension can become a no-op.
    
    I should give credit where it's due: @hsyl20 really did all the work for
    me in
    ghc/ghc!4717 (comment 355874),
    but I was daft and missed the "Oops" and so ended up spending a silly
    amount of time putting it all back together myself.
    
    The unregisterised backend change is a bit different, because here we
    are translating the actual case not a jump table, and the fix is to
    handle right-sized literals not addressing modes. But it makes sense to
    include here too because it's the same change in the subsequent commit
    that exposes both bugs.
    e8f7734d