Menu

#3604 gte/20040307-1.c fails for hc08/s08 on big-endian host

closed-fixed
None
other
5
2023-07-07
2023-06-26
No

According to the snapshots page, the regression test gte/20040307-1.c fails for macOS on PowerPC, which is currently the only big-endian system in the compile farm.

Related

Wiki: NGI0-Entrust-SDCC

Discussion

  • Erik Petrich

    Erik Petrich - 2023-06-28

    I can confirm that incorrect code is being generated:

    _main_:
    ;/Users/sdcc-builder/build/sdcc-build/orig/sdcc/support/regression/cases/../gte/20040307-1.c:14: } sdata = {0x01};
    ;     genPointerSet
    ;     genPackBitsImmed
        lda _main__sdata_65536_8
        ora #0x00
        sta _main__sdata_65536_8
    

    The "ora #0x00" should be "ora #0x01". However, if the underlying literal value was truly 0, the ora instruction should be omitted, which implies that the literal value is not actually 0 but somehow still converts to "00" with the %02x formatting specifier.

     
    • Philipp Klaus Krause

      That looks like it could be the bug: %02x is a format specifier for an unsigned int. The argument is a signed int.

      P.S.: Actually, litval is a unsigned long cast to signed int cast to unsigned long long. So %02llx should be correct. I'll put that into the next branch.

       

      Last edit: Philipp Klaus Krause 2023-06-30
  • Philipp Klaus Krause

    Fixed in the next branch in [r14194].

     

    Related

    Commit: [r14194]

  • Philipp Klaus Krause

    • status: open --> closed-fixed
    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    Fixed in [r14211] by merging next to trunk.

     

    Related

    Commit: [r14211]


Log in to post a comment.