Menu

#3511 assign struct with bitwise member of 8 bits fails with mnemonic error

closed-fixed
None
MOS6502
5
2023-12-24
2022-10-26
Under4Mhz
No

The below code fails when compiling for 6502:

sdcc -mmos6502 ./struct_bits.c 
./struct_bits.c:11: warning 283: function declarator with no prototype
./struct_bits.c:14: warning 84: 'auto' variable 'voicePtr' may be used before initialization
struct_bits.asm:84: Error: <o> .org in REL area or directive / mnemonic error
removing struct_bits.rel
/// GPL 2.0 or later
#include <stdint.h>

typedef struct VoiceData {

    uint8_t index : 8;
    uint8_t size;

} VoiceData;

void SoundVoiceSet2( ) {

    VoiceData *voicePtr;
    voicePtr->index = voicePtr->size - 1;
}

The asm file contains:

...
    sta *(__DPTR+1)
    ERROR   Unimplemented genPackBits
;   ./struct_bits.c: 18: }
sdcc -v
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/sm83/tlcs90/ez80_z80/z80n/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502 4.2.9 #13727 (Linux)

Discussion

  • Philipp Klaus Krause

    • Category: other --> MOS6502
     
  • Gabriele Gorla

    Gabriele Gorla - 2023-12-04

    should be fixed in [r14501]

     

    Related

    Commit: [r14501]


    Last edit: Gabriele Gorla 2023-12-04
  • Gabriele Gorla

    Gabriele Gorla - 2023-12-04
    • status: open --> pending-fixed
    • assigned_to: Gabriele Gorla
     
    • Maarten Brock

      Maarten Brock - 2023-12-08

      Why is this pending-fixed and not closed-fixed?

       
  • Gabriele Gorla

    Gabriele Gorla - 2023-12-24
    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.