incorrect static char * assumption(?)

Horst von Brand
Tue Mar 7 13:09:00 GMT 2000

Richard <> said:
> egcs-2.91.66 appears to be making an erroneous assumption about the
> contents of a static char * within a single printf() call.

You are calling a function that modifies a global variable (side effect)
twice in ths argument list of a function. Noone guarantees in which order
the arguments of a function call are evaluated, so you are invoking
undefined behaviuor: Anything can happen.
Dr. Horst H. von Brand             
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

More information about the Gcc-bugs mailing list