This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix tree-opt/21840, FRE/PRE mismatch types inMODIFY_EXPR


On Tue, 2005-07-12 at 21:36 -0400, Andrew Pinski wrote:
> The problem here is that PRE/FRE forgets to add a cast if we going from
> a void* to another type (like a function pointer).  Since x86 requires
> the correct function type to be able to call the function, the cast is
> really needed.  This is caught even without my patch attached in PR 
> 22368.
> 
> This patch fixes the type mismatch by converting the type to the correct
> type.  The reason why this is safe is because we always get back either
> a SSA_NAME or a constant and we can cast that expression and still be
> valid gimple as we are always replacing the rhs of a MODIFY_EXPR.
> 
> OK? Bootstrapped and tested on powerpc-darwin with no regressions.
> 

This is fine.  Could you please add a small comment above the code
you've added saying something like

"We need to make sure the new and old types actually match, which may
require adding a simple cast, which fold_convert will do for us"

(or whatever)


> 
> Thanks,
> Andrew Pinski
> 
> ChangeLog:
> 
> 	* tree-ssa-pre.c (eliminate): Convert the sprime to the correct type
> 	if *rhs_p is not a SSA_NAME.
> 
> testsuite/ChangeLog:
> 
> 	* gcc.c-torture/compile/pr21840.c: New test.
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]