Notice that this is an UNSIGNED char array. Yet the programmer is putting negative numbers in there. These negative numbers are 16-bit integers. For example, -16 is represented as 0xffea . The compiler then tries to fit 0xffea into an 8-bit unsigned char. It does its best by using only the least significant byte and emitting an warning to let you know it has done so.
So all those warnings are the fault of the programmer. sdcc is right to warn about it -- these types of errors can often turn out to be bugs. In this case these aren't bugs.
A little later in the compile you will see another warning about a pointer losing CONST. This is because the programmer has implicitly casted from a CONST pointer to a regular pointer. Again, this warning is correct and it is emitted because this is another common type of bug. But in this case there is no bug.
Beginners may find the warnings disconcerting or annoying but for the experienced they can be invaluable for tracking down difficult to find bugs. The fact that other compilers may not report these things as warnings is a weakness of those other compilers.
I did the same compile with zsdcc but this time zsdcc will use "--reserve-regs-iy" which is implied by "-clib=sdcc_iy". In the resulting code there are two places where z88dk fixes up bugs in sdcc. In z88dk it's preferable to use "--reserve-regs-iy" because it leads to much smaller code in general when z88dk's aggressive peephole set is applied.
[свернуть]