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 pr22550


 Hi,

  This fixes PR22550 by simply returning COND in vrp_evaluate_condition if
it is an INTEGER_CST.  In PR22550 I believe the if (0) comes from
merge_seq_blocks which is called after cleanup_control_flow in
cleanup_tree_cfg.  This patch has been bootstrapped and regtested on ia64-linux
with no new regressions, ok for mainline?

-- 
Thanks,
Jim

http://www.csclub.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim

2005-07-25  James A. Morrison  <phython@gcc.gnu.org>

	PR tree-optimization/22550
	* tree-vrp.c (vrp_evaluate_condition): Return COND if it is an
	INTEGER_CST.

Index: tree-vrp.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/tree-vrp.c,v
retrieving revision 2.42
diff -u -p -r2.42 tree-vrp.c
--- tree-vrp.c	20 Jul 2005 20:26:00 -0000	2.42
+++ tree-vrp.c	25 Jul 2005 14:22:55 -0000
@@ -3014,6 +3072,9 @@ compare_names (enum tree_code comp, tree
 tree
 vrp_evaluate_conditional (tree cond, bool use_equiv_p)
 {
+  if (TREE_CODE (cond) == INTEGER_CST)
+    return cond;
+
   gcc_assert (TREE_CODE (cond) == SSA_NAME
               || TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison);
 
/* { dg-do compile } */
/* { dg-options "-O2" } */

class X {
public:
  int mfunc1 () {
    return 1;
  }
  int mfunc2 () {
    return 2;
  }
  X (int a, int b) { }
};

typedef int (X::*memfunc_p_t) ();

memfunc_p_t mf_arr[2] = { &X::mfunc1, &X::mfunc2 };

int
main ()
{
  // Get pntr to the array of pointers to member-funcs
  memfunc_p_t (*mf_arr_p)[2] = &mf_arr;
  // Compare indirect against direct access to an array element
  if ((*mf_arr_p)[0] != mf_arr[0])
    return 1;
  return 0;
}

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