This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix tree-opt/21840, FRE/PRE mismatch types inMODIFY_EXPR
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 12 Jul 2005 21:58:47 -0400
- Subject: Re: [PATCH] Fix tree-opt/21840, FRE/PRE mismatch types inMODIFY_EXPR
- References: <firstname.lastname@example.org>
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
> 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"
> Andrew Pinski
> * tree-ssa-pre.c (eliminate): Convert the sprime to the correct type
> if *rhs_p is not a SSA_NAME.
> * gcc.c-torture/compile/pr21840.c: New test.