From: Jakub Jelinek Date: Tue, 19 Aug 2008 11:44:42 +0000 (+0200) Subject: re PR debug/37156 (Hang with -g -O2 (or higher) (discovered with malloc.c in sqlite3)) X-Git-Tag: releases/gcc-4.4.0~3073 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e92cbe3a1df3f5ad7027d9863c5a49c34cf789e9;p=thirdparty%2Fgcc.git re PR debug/37156 (Hang with -g -O2 (or higher) (discovered with malloc.c in sqlite3)) 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 68e7be66686c..a170704b41e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-08-19 Jakub Jelinek + + 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 PR tree-optimization/35972 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a684338d6542..4ffb96e85de4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2008-08-19 Jakub Jelinek + + PR debug/37156 + * error.c (cp_print_error_function): Deal with recursive BLOCK trees. + 2008-08-18 Tomas Bily * tree.c (cp_tree_equal): Use CONVERT_EXPR_CODE_P. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 03ceddffb78b..177d082f98ae 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -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; diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c index 35dca7ca68cf..fdac10e9d44f 100644 --- a/gcc/pretty-print.c +++ b/gcc/pretty-print.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e51e9a6012f2..7499840aa3d8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-08-19 Jakub Jelinek + + PR debug/37156 + * gcc.dg/pr37156.c: New test. + 2008-08-19 Richard Guenther PR tree-optimization/35972 diff --git a/gcc/testsuite/gcc.dg/pr37156.c b/gcc/testsuite/gcc.dg/pr37156.c new file mode 100644 index 000000000000..e86f5950f734 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr37156.c @@ -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; +} diff --git a/gcc/tree.c b/gcc/tree.c index 4441bc0abe4d..95d4d5ea61e0 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -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)