err ?ASlink-Warning-Undefined Global '___str_0' referenced by module 'main'
Closed this issue · 2 comments
dzantemir commented
#include "stdio.h"
#include "stm8s.h"
void main(void)
{
float gg=123.123;
char str[20]; //create an empty string to store number
sprintf(str, "%f", gg);//make the number into string using sprintf function
}
sdcc 4.4.1
platformio
extra_scripts = use_stm8dce.py
?ASlink-Warning-Undefined Global '___str_0' referenced by module 'main'
CTXz commented
Likely related to the ___str_0
const (these are generated by full asserts) not getting loaded via ldw
but push
instructions. Since the dce tool only checks for load instructions to evaluate if a constant is used, it falsely optimizes it away.
A fix for this is currently in works where all memory read instructions are tested for constants, not just ld/ldw/ldf
. I'll publish it today or tomorrow.
This will also hopefully also improve backwards- and upwards compatibility for different SDCC versions