Does that mean your example is still an error? static struct { unsigned char STK[128]; } s; void *v = (void *)(s.STK + 1); I think section 6.6 explicitly mentions this case: 7 More latitude is permitted for constant expressions in initializers. Such a constant expression shall be, or evaluate to, one of the following: ... — an address constant for a complete object type plus or minus an integer constant expression.
Ok, maybe that was the root of the problems I've seen? The z88dk library uses preserves_regs extensively.
The recent commit: https://sourceforge.net/p/sdcc/code/9998/tree/trunk/sdcc/src/z80/main.c?diff=513f4d42271846342871488b:9997&diformat=sidebyside would seem to indicate there were major bugs associated with preserves_regs on the z80 but I haven't seen any of that up to 9958 (I haven't updated from there yet because some bugs have been introduced since that I haven't had the time to locate yet). Was there a change after 9958 that required changing the register enumeration?
incorrect initialization of static array of pointers
Also reported in #2632
Works fine for me. Maybe try updating your install? 4,844 1.asm 80 1.c 715 1.ihx 238 1.lk 10,684 1.lst 13,367 1.map 1,192 1.mem 2,016 1.rel 10,684 1.rst 31,836 1.sym sdcc -v 3.6.8 9949 (MINGW64) >sdcc --verbose 1.c sdcc: Calling preprocessor... sdcc: sdcpp -nostdinc -Wall -std=c11 -obj-ext=.rel -D__SDCC_CHAR_UNSIGNED -D__SDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -D__SDCC=3_6_8 -D__SDCC_VERSION_MAJOR=3 -D__SDCC_VERSION_MINOR=6 -D__SDCC_VERSION_PATCH=8 -DSDCC=368 -D__SDCC_REVISION=9949 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__=1...
z80: array index incorrectly computed by truncating 16-bit computed value to 8-bit
Provided it knows which symbol is requested during linking and the object has its clear boundaries in library... That's the problem.. there are no clear boundaries in the library between items in the same file. That's why it's necessary to split into files first. If you know this from the beginning, it's less a big deal. However I'm more used to making libraries out of z80 asm functions where separation into files turns out to be a good way to organize asm code. This is less natural for C code I...