There is a bug in printf-stdarg.c when compiling for the large data model. Line 150: register char *s = (char *)va_arg( args, int ); Should change to: register char *s = (char *)va_arg( args, char * );
I think there are three supported compilers, which one needs the change?
I’ve tested this on CCS4.2.3, however it is probably relevant to all three (if they support the large data model). With the large data model, data pointers (e.g. char *) are 32 bits, whereas the same pointers are 16 bits in the small memory model. In both cases ints are 16 bits, so when the va_arg is incremented it ends up pointing at the high word of the char pointer, rather than pointing to the next argument. This should fail on any platform in which pointers are not the same size as ints (assuming TI’s va_arg implementation is correct).
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.