Menu

#3503 unsupported aop type with pointer check in while loop

closed-fixed
None
Z80
5
2023-01-23
2022-10-09
Under4Mhz
No

When I compile the below code I get the following error:

sdcc -mz80 ./arraysizecheck.c 
./arraysizecheck.c:12: warning 283: function declarator with no prototype
op8_cost op: 7
./arraysizecheck.c:24: error 9: FATAL Compiler Internal Error in file 'gen.c' line number '990' : code generator internal error 
Contact Author with source code
op8_cost op: 7
...
op8_cost op: 7
aop->type: 7
./arraysizecheck.c:24: error 9: FATAL Compiler Internal Error in file 'gen.c' line number '3082' : aopGet got unsupported aop->type 
Contact Author with source code

gcc -c ./arraysizecheck.c && ls -s arraysizecheck.o
4 arraysizecheck.o
/// GPL 2.0 or later
#include <stdint.h>

typedef struct {

    uint16_t object;

} SegmentData;

void RayDraw() {

    SegmentData segments[22];
    SegmentData *segment = segments;
    uint8_t pos = 0;

    do {

        if ( segment >= segments + 1 )
            segment--;

    } while( pos++ < 32 );
}
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 

Related

Bugs: #3058
Bugs: #3398
Wiki: NGI0-Entrust-SDCC

Discussion

  • Philipp Klaus Krause

    I can reproduce this issue in current 4.2.12 #13811 on my amd64 Debian GNU/Linux testing system.

     
  • Philipp Klaus Krause

    • assigned_to: Philipp Klaus Krause
    • Category: other --> Z80
     
  • Philipp Klaus Krause

    I have a fix for this z80 codegen issue, and a regression test. However there is a similar bug for pd15 when using --stack-auto that I still need to fix.

     
  • Philipp Klaus Krause

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

    Fixed in [r13814].

     

    Related

    Commit: [r13814]


Log in to post a comment.

MongoDB Logo MongoDB