OSDN Git Service

PR c++/42234
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 1 Dec 2009 19:41:52 +0000 (19:41 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 1 Dec 2009 19:41:52 +0000 (19:41 +0000)
* tree-cfgcleanup.c (cleanup_omp_return): Don't ICE if control_bb
contains no statements.

* g++.dg/gomp/pr42234.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154878 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gomp/pr42234.C [new file with mode: 0644]
gcc/tree-cfgcleanup.c

index 1b82233..ef355dd 100644 (file)
@@ -1,3 +1,9 @@
+2009-12-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/42234
+       * tree-cfgcleanup.c (cleanup_omp_return): Don't ICE if control_bb
+       contains no statements.
+
 2009-12-01  Grigori Fursin  <grigori.fursin@inria.fr>
            Joern Rennecke  <amylaar@spamcop.net>
 
index c691529..3d0561a 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/42234
+       * g++.dg/gomp/pr42234.C: New test.
+
 2009-12-01  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/42237
diff --git a/gcc/testsuite/g++.dg/gomp/pr42234.C b/gcc/testsuite/g++.dg/gomp/pr42234.C
new file mode 100644 (file)
index 0000000..9245b6c
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/42234
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+extern int foo (void);
+
+void
+bar (int x)
+{
+  #pragma omp critical
+    {
+      int j;
+      for (j = 0; j < foo (); j++)
+       ;
+      if (0)
+        if (x >= 4)
+         ;
+    }
+}
index 495450b..9fb489a 100644 (file)
@@ -1,5 +1,5 @@
 /* CFG cleanup for trees.
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -511,7 +511,7 @@ cleanup_omp_return (basic_block bb)
   control_bb = single_pred (bb);
   stmt = last_stmt (control_bb);
 
-  if (gimple_code (stmt) != GIMPLE_OMP_SECTIONS_SWITCH)
+  if (stmt == NULL || gimple_code (stmt) != GIMPLE_OMP_SECTIONS_SWITCH)
     return false;
 
   /* The block with the control statement normally has two entry edges -- one