This is the mail archive of the 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]

[tree-ssa] [PATCH] Fix PR 15245 ICE due to tree-ssa-phiopt using convert instead of fold_convert

First I am sorry I did not see this before the tree-ssa was frozen the rest
of the way but this patch should be very simple and should be acceptable.

OK? Tested on powerpc-apple-darwin with no regressions.

Andrew Pinski

Testcase: char *f(char *x, int flag) { char *ret = (char*)0;

    if( x > (char*)1 ) {
	return (char*)0;
    } else {
      if( flag & 1 )
	ret = (char*)1;
      flag |= 2;
    return ret;


	* tree-ssa-phiopt.c (conditional_replacement): Use fold_convert
	instead of convert.

Index: tree-ssa-phiopt.c
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-phiopt.c,v
retrieving revision
diff -u -p -r1.1.2.10 tree-ssa-phiopt.c
--- tree-ssa-phiopt.c 19 Apr 2004 14:28:20 -0000
+++ tree-ssa-phiopt.c 1 May 2004 19:52:41 -0000
@@ -185,7 +185,7 @@ conditional_replacement (basic_block bb,
same as the type of the result, then convert the type of the
condition. */
if (!lang_hooks.types_compatible_p (TREE_TYPE (cond), TREE_TYPE (result)))
- cond = convert (TREE_TYPE (result), cond);
+ cond = fold_convert (TREE_TYPE (result), cond);

   /* We need to know which is the true edge and which is the false
       edge so that we know when to invert the condition below.  */

Attachment: temp.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]