[PATCH] analysis of global statics and removal associated vdefs and vuses

Kenneth Zadeck zadeck@naturalbridge.com
Mon Aug 30 01:32:00 GMT 2004



Mark Mitchell wrote:

> Kenneth Zadeck wrote:
>
>> Is it possible to notice this by looking at the format string?  Given 
>> that we have a pass that parses this string and produces messages 
>> when the args do not match, can we just look for non standard formats 
>> (with the obvious caveats that if we do not see the string, we have 
>> to assume the worst...)
>
>
> No; you are specifically allowed to redefine the meanings of the 
> built-in formats like "%d".  And the registration of such 
> redefinitions occurs by calling a function (register_printf_function) 
> rather than as part of the call of printf itself.  So, with GNU libc, 
> you just can't do what you want, sadly.
>
Just for the record, this sucks. However, it is what it is and if we 
cannot do any better we will just move on. 

However, once we get the aliasing really working, we may find that this 
is a significant performance problem in real (i.e. non bench marking) 
code. In real code, significant number of functions have calls to printf 
and because of this extension a call to any function that calls printf, 
must clobber every static variable.  Without the extension, the calls to 
printf (assuming we could properly annotate them,) would not effect the 
clobber sets at all. 




More information about the Gcc-patches mailing list