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]

[PATCH] Fix tree-opt/21840, FRE/PRE mismatch types in MODIFY_EXPR


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.


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.

Attachment: t.7.diff.txt
Description: Text document


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