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 d38611b..7bc3702 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 3943f02..e246047 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)