]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/24840 (ICE process_assert_insertions_for, at tree-vrp.c:2807)
authorDiego Novillo <dnovillo@redhat.com>
Tue, 15 Nov 2005 02:59:03 +0000 (02:59 +0000)
committerDiego Novillo <dnovillo@gcc.gnu.org>
Tue, 15 Nov 2005 02:59:03 +0000 (21:59 -0500)
PR 24840
* tree-vrp.c (infer_value_range): Return false if STMT is a
block terminator and its basic block has no successors.

testsuite/

PR 24840
* gcc.dg/tree-ssa/pr24840.c: New test.

From-SVN: r106930

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr24840.c [new file with mode: 0644]
gcc/tree-vrp.c

index 032b12910b44bd28bce65f74c7fbd9f1f44c1cc1..804e6b513bed2750d027af11f95cf8f22a553391 100644 (file)
@@ -1,3 +1,9 @@
+2005-11-14  Diego Novillo  <dnovillo@redhat.com>
+
+       PR 24840
+       * tree-vrp.c (infer_value_range): Return false if STMT is a
+       block terminator and its basic block has no successors.
+
 2005-11-14  Mike Stump  <mrs@apple.com>
 
        * config/i386/i386.c (override_options): -masm=intel isn't
index ba2ffa268014d5279b981df0299552435f291f8f..2c2f3976be20a1cba93af2adfef3b37989da7104 100644 (file)
@@ -1,3 +1,8 @@
+2005-11-14  Diego Novillo  <dnovillo@redhat.com>
+
+       PR 24840
+       * gcc.dg/tree-ssa/pr24840.c: New test.
+
 2005-11-14  Janis Johnson  <janis187@us.ibm.com>
 
        PR testsuite/24841
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr24840.c b/gcc/testsuite/gcc.dg/tree-ssa/pr24840.c
new file mode 100644 (file)
index 0000000..736dafd
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef struct
+{
+  int tag, y;
+} Object;
+
+void Err_Handler () __attribute__ ((__noreturn__));
+
+int
+P_Error (int argc, Object * argv)
+{
+    if (((argv[1]).tag >> 1) != 11)
+      Wrong_Type (argv[1], 11);
+  Err_Handler (argv[0], argv[1], argc - 2, argv + 2);
+}
index d49c4d40d32d4e2e5e06a7595d2d2caf3d2ebb1b..f88b23e1aeb59f3af7bd34ba002a171e5ffe57ee 100644 (file)
@@ -2221,6 +2221,13 @@ infer_value_range (tree stmt, tree op, enum tree_code *comp_code_p, tree *val_p)
   if (tree_could_throw_p (stmt))
     return false;
 
+  /* If STMT is the last statement of a basic block with no
+     successors, there is no point inferring anything about any of its
+     operands.  We would not be able to find a proper insertion point
+     for the assertion, anyway.  */
+  if (stmt_ends_bb_p (stmt) && EDGE_COUNT (bb_for_stmt (stmt)->succs) == 0)
+    return false;
+
   if (POINTER_TYPE_P (TREE_TYPE (op)))
     {
       bool is_store;