re PR middle-end/36811 (endless (?) loop building with -O3)
authorRichard Guenther <rguenther@suse.de>
Sun, 13 Jul 2008 17:28:26 +0000 (17:28 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sun, 13 Jul 2008 17:28:26 +0000 (17:28 +0000)
2008-07-13  Richard Guenther  <rguenther@suse.de>

PR middle-end/36811
* langhooks.c (lhd_print_error_function): Deal with recursive
BLOCK trees.

From-SVN: r137754

gcc/ChangeLog
gcc/langhooks.c

index d38611b8fb28d337eed1d0b3ca321c14b0e0c72b..7bc3702b329bbc08ac457ac3588e38aee235e63a 100644 (file)
@@ -1,3 +1,9 @@
+2008-07-13  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/36811
+       * langhooks.c (lhd_print_error_function): Deal with recursive
+       BLOCK trees.
+
 2008-07-12  Jan Hubicka  <jh@suse.cz>
 
        * cgraph.c (assembler_name_hash): New static var.
index 3943f02b794f75dbc90446fccb0d3a6f5b2ee3ff..e2460473f54aa24e7f9dce8569328a76e9ed1cce 100644 (file)
@@ -394,7 +394,9 @@ lhd_print_error_function (diagnostic_context *context, const char *file,
          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;
@@ -424,7 +426,9 @@ lhd_print_error_function (diagnostic_context *context, const char *file,
                {
                  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)