From ca9e4658484fe6bffb4f4e29ff17d80d51daa96a Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 2 Sep 2008 13:48:11 +0000 Subject: 2008-09-02 Richard Guenther PR tree-optimization/37327 * tree-vrp.c (register_new_assert_for): Make sure to not have TREE_OVERFLOW set on the bound. * gcc.c-torture/compile/pr37327.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139890 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-vrp.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/tree-vrp.c') diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 348382ecae3..8db35ca42d9 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -3785,6 +3785,14 @@ register_new_assert_for (tree name, tree expr, && gimple_code (gsi_stmt (si)) != GIMPLE_SWITCH); #endif + /* Never build an assert comparing against an integer constant with + TREE_OVERFLOW set. This confuses our undefined overflow warning + machinery. */ + if (TREE_CODE (val) == INTEGER_CST + && TREE_OVERFLOW (val)) + val = build_int_cst_wide (TREE_TYPE (val), + TREE_INT_CST_LOW (val), TREE_INT_CST_HIGH (val)); + /* The new assertion A will be inserted at BB or E. We need to determine if the new location is dominated by a previously registered location for A. If we are doing an edge insertion, -- cgit v1.2.1