[PATCH] New predicate covering NOP_EXPR and CONVERT_EXPR

Richard Guenther rguenther@suse.de
Fri Dec 2 18:13:00 GMT 2005


On Fri, 2 Dec 2005, Joseph S. Myers wrote:

> By way of illustration of real distinctions present in the code, here is 
> the first problem with a blind unification which I found in a *few 
> minutes' checking*.  Compile
> 
> int printf(const char *, ...);
> void f(void) { printf((char *)(short)"%"); }
> 
> with -Wall; there is no format warning.  But if you make 
> check_function_arguments_recurse allow CONVERT_EXPR as well as NOP_EXPR, 
> there is a format warning (which is inappropriate; the conversions may be 
> dodgy, but the format isn't in any way a constant string that can be 
> format checked).

But this is (or should be) purely a frontend issue and has nothing to do
with the middle-end treating NOP_EXPR and CONVERT_EXPR the same.  Same
reasoning applies to NON_LVALUE_EXPR, which in some cases somebody
remembered to handle the same as NOP_EXPR/CONVERT_EXPR in fold, in some
cases not.  We should really try to separate the frontends from the
middle-end here.  Even if it means not doing _any_ simplification
in the frontend until reaching the gimplifier (apart from the
integer-constant-expression issues).

A long way to go...
Richard.



More information about the Java-patches mailing list