]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR debug/37156 (Hang with -g -O2 (or higher) (discovered with malloc.c in sqlite3))
authorJakub Jelinek <jakub@redhat.com>
Tue, 19 Aug 2008 11:44:42 +0000 (13:44 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 19 Aug 2008 11:44:42 +0000 (13:44 +0200)
PR debug/37156
* pretty-print.c (pp_base_format): Deal with recursive BLOCK trees.
* tree.c (block_nonartificial_location): Likewise.

* error.c (cp_print_error_function): Deal with recursive BLOCK trees.

* gcc.dg/pr37156.c: New test.

From-SVN: r139230

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/error.c
gcc/pretty-print.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr37156.c [new file with mode: 0644]
gcc/tree.c

index 68e7be66686cd109939394832e190e89456bcdb0..a170704b41e454149466979034261dd64f251df2 100644 (file)
@@ -1,3 +1,9 @@
+2008-08-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/37156
+       * pretty-print.c (pp_base_format): Deal with recursive BLOCK trees.
+       * tree.c (block_nonartificial_location): Likewise.
+
 2008-08-19  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/35972
index a684338d65426c1abc742a7381d3640ceb3e4570..4ffb96e85de43d22f631c818db9b768b7387340a 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/37156
+       * error.c (cp_print_error_function): Deal with recursive BLOCK trees.
+
 2008-08-18  Tomas Bily  <tbily@suse.cz>
 
        * tree.c (cp_tree_equal): Use CONVERT_EXPR_CODE_P.
index 03ceddffb78b5ffafab25a550f267af2a08ddcab..177d082f98aef240347e7c3cd3512188f42f23a4 100644 (file)
@@ -2388,7 +2388,9 @@ cp_print_error_function (diagnostic_context *context,
          if (abstract_origin)
            {
              ao = BLOCK_ABSTRACT_ORIGIN (abstract_origin);
-             while (TREE_CODE (ao) == BLOCK && BLOCK_ABSTRACT_ORIGIN (ao))
+             while (TREE_CODE (ao) == BLOCK
+                    && BLOCK_ABSTRACT_ORIGIN (ao)
+                    && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
                ao = BLOCK_ABSTRACT_ORIGIN (ao);
              gcc_assert (TREE_CODE (ao) == FUNCTION_DECL);
              fndecl = ao;
index 35dca7ca68cfab40a2431e39c4a62537af365929..fdac10e9d44f85e2eed29cdcb2325d83904b16c9 100644 (file)
@@ -501,7 +501,9 @@ pp_base_format (pretty_printer *pp, text_info *text)
              {
                tree ao = BLOCK_ABSTRACT_ORIGIN (block);
 
-               while (TREE_CODE (ao) == BLOCK && BLOCK_ABSTRACT_ORIGIN (ao))
+               while (TREE_CODE (ao) == BLOCK
+                      && BLOCK_ABSTRACT_ORIGIN (ao)
+                      && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
                  ao = BLOCK_ABSTRACT_ORIGIN (ao);
 
                if (TREE_CODE (ao) == FUNCTION_DECL)
index e51e9a6012f24b85681443fc0cfa7d15c63ae3f7..7499840aa3d809a09232e48bcbd6ea7a0e71fe65 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/37156
+       * gcc.dg/pr37156.c: New test.
+
 2008-08-19  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/35972
diff --git a/gcc/testsuite/gcc.dg/pr37156.c b/gcc/testsuite/gcc.dg/pr37156.c
new file mode 100644 (file)
index 0000000..e86f595
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR debug/37156 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+__attribute__ ((warning ("is experimental"))) int bar (int, int *, int *, int);
+
+long long foo (void)
+{
+  int n, m;
+  long long r;
+  bar (0, &n, &m, 0);  /* { dg-warning "is experimental" } */
+  r = (long long) n;
+  return r;
+}
+
+void
+baz (int n)
+{
+  int o;
+  o = foo () - n;
+}
index 4441bc0abe4d7313b49fdf1e6682406cbc5e3a5e..95d4d5ea61e01d41a4d14cc6aba329bceaa24a1b 100644 (file)
@@ -8819,7 +8819,9 @@ block_nonartificial_location (tree block)
     {
       tree ao = BLOCK_ABSTRACT_ORIGIN (block);
 
-      while (TREE_CODE (ao) == BLOCK && BLOCK_ABSTRACT_ORIGIN (ao))
+      while (TREE_CODE (ao) == BLOCK
+            && BLOCK_ABSTRACT_ORIGIN (ao)
+            && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
        ao = BLOCK_ABSTRACT_ORIGIN (ao);
 
       if (TREE_CODE (ao) == FUNCTION_DECL)