This patch really only deals with targets which have PTR_SIZE == 4. In e.g. generated code from heirloom lex, static arrays may have initializers of the form `ptr + -1`. Tcc would previously evaluate this on i386 as
ptr + ((unsigned int)(sizeof *ptr) * (int)(-1)) which implicitly converts -1 to `(1U << 32) - 1`. This is ok for codegen, but the constant evaluation for ptr+int in gen_op explicitly blocks offsets beyond 1<<31. This in turn means that such expressions could not be used for static initializers. This patch preserves the signedness of the offset expression to prevent this unwanted implicit conversion. I'm not sure whether this is the best possible patch or if it is sound. Feedback would be appreciated. Aleksi Hannula (1): tccgen: Keep pointer delta signedness tccgen.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.51.2 _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
