Menu

#4051 Internal error: validateLink failed

open
nobody
None
other
5
2 days ago
2 days ago
Under4Mhz
No

The below code gives the following error. The code is invalid and ideally sdcc would provide a line number for the invalid code.

Internal error: validateLink failed in DCL_PTR_CONST(type) @ SDCCsymt.c:5459: expected DECLARATOR, got null-link
/// GPL 2.0 or later
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>

#define vdu_declare_tiles( name )                                 \
        extern const uint8_t STRCAT(name,_pixels)[];                   \
        extern const uint8_t STRCAT(name,_colours)[]

void main(void) {

    vdu_declare_tiles(name);
}
$ sdcc -mz80 --fverbose-asm ./invalid_warning.c  -c
Internal error: validateLink failed in DCL_PTR_CONST(type) @ SDCCsymt.c:5459: expected DECLARATOR, got null-link
pchandler:~/local/projects/example/src/experimental/bugs
$ gcc ./invalid_warning.c
./invalid_warning.c: In function ‘main’:
./invalid_warning.c:8:30: error: ‘STRCAT’ declared as function returning an array
    8 |         extern const uint8_t STRCAT(name,_pixels)[];                   \
      |                              ^~~~~~
./invalid_warning.c:13:5: note: in expansion of macro ‘vdu_declare_tiles’
   13 |     vdu_declare_tiles(name);
      |     ^~~~~~~~~~~~~~~~~
./invalid_warning.c:13:5: warning: parameter names (without types) in function declaration
./invalid_warning.c:9:30: error: ‘STRCAT’ declared as function returning an array
    9 |         extern const uint8_t STRCAT(name,_colours)[]
      |                              ^~~~~~
./invalid_warning.c:13:5: note: in expansion of macro ‘vdu_declare_tiles’
   13 |     vdu_declare_tiles(name);
      |     ^~~~~~~~~~~~~~~~~
./invalid_warning.c:13:5: warning: parameter names (without types) in function declaration
sdcc -v
SDCC : z80/sm83/ez80/z80n/mos6502/mos65c02 4.6.2 #16701 

Discussion


Log in to post a comment.