I think I found a pretty serious, well-hidden bug in 4.7.0-20120911 and/or its optimizer.
To reproduce try:
a main() with a (20-bit) data pointer as local variable *bufPtr. Then call a function g(&bufPtr) and pass a pointer to this variable. This function itself calls another function f() by its function-pointer fPtr (= &f).
After the calls to g() and f() an sprintf() is not able to interpret %d anymore and does just nothing. This occurs only with memory-model "large" or "huge" and only if an optimizer -O, -O2 or -Os is used. As workaround we try to use memory-model "medium" (= 16bit-pointers to data only).
See attachment for the whole example code!
Realistic usecase: in our application g() is called allocateBuffer(&bufPtr) and fPtr is a callback which is assigned to a function of a module (= .h/.c) in an upper layer.
I don't think this bug is a duplicate of bug [#350]. I implemented a my_sprintf() and a my_printf() that do call va_start() and va_end() in the same function, but this bug still occurs.
It is not like bug [#345], because I do not see any compiler errors or warnings.
It may be related to bug [#352], but then I clearly propose to set the priority of both bugs to at least 7! This bug is quite hard to find, to understand and to work-around.