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 type mismatch produced by tree-vrp


The problem here is that we get an INTEGER_CST of boolean type from
vrp_evaluate_conditional but we need to convert it if have a condition
expression with an integer type. This patch fixes the problem by converting
the val to the correct type before replacing the predicate. We only need
to the conversion if we have a MODIFY_EXPR.


This was found during bootstrap with the patch in PR 22368 to catch the
type mismatch in MODIFY_EXPRs.

OK? Bootstrapped and tested on powerpc-darwin with no regressions.

Thanks,
Andrew Pinski

ChangeLog:

	* tree-ssa-propagate.c (fold_predicate_in): Convert the value
	to the correct type if we have a MODIFY_EXPR.


Attachment: tree-vrp.diff.txt
Description: Text document



Testcase:
/* { dg-do compile } */
/* { dg-options "-O2" } */
int f(int i)
{
  int k = 0;
  if (i == 0)
    k = i == 0;
  return k;
}

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