public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix Infinite loop in pointer_set_insert
@ 2012-12-16 16:33 John David Anglin
  2012-12-16 17:11 ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: John David Anglin @ 2012-12-16 16:33 UTC (permalink / raw)
  To: gcc-patches

The attached patch fixes a regression introduced on the trunk to
fix PR middle-end/52640.  The fix was previously applied to the 4.6
and 4.7 branches.

Tested on hppa-unknown-linux-gnu with full bootstrap.

OK for trunk?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2012-12-16  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	PR middle-end/55709
	Forward port from 4.7 branch:
	2012-04-10  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	PR middle-end/52894
	* varasm.c (process_pending_assemble_externals): Set
	pending_assemble_externals_processed true.
	(assemble_external): Call assemble_external_real if the pending
	assemble externals have been processed.

Index: varasm.c
===================================================================
--- varasm.c	(revision 194441)
+++ varasm.c	(working copy)
@@ -2088,6 +2088,11 @@
    it all the way to final.  See PR 17982 for further discussion.  */
 static GTY(()) tree pending_assemble_externals;
 
+/* Some targets delay some output to final using TARGET_ASM_FILE_END.
+   As a result, assemble_external can be called after the list of externals
+   is processed and the pointer set destroyed.  */
+static bool pending_assemble_externals_processed;
+
 #ifdef ASM_OUTPUT_EXTERNAL
 /* Avoid O(external_decls**2) lookups in the pending_assemble_externals
    TREE_LIST in assemble_external.  */
@@ -2144,6 +2149,7 @@
     assemble_external_real (TREE_VALUE (list));
 
   pending_assemble_externals = 0;
+  pending_assemble_externals_processed = true;
   pointer_set_destroy (pending_assemble_externals_set);
 #endif
 }
@@ -2196,6 +2202,12 @@
     weak_decls = tree_cons (NULL, decl, weak_decls);
 
 #ifdef ASM_OUTPUT_EXTERNAL
+  if (pending_assemble_externals_processed)
+    {
+      assemble_external_real (decl);
+      return;
+    }
+
   if (! pointer_set_insert (pending_assemble_externals_set, decl))
     pending_assemble_externals = tree_cons (NULL, decl,
 					    pending_assemble_externals);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix Infinite loop in pointer_set_insert
  2012-12-16 16:33 [PATCH] Fix Infinite loop in pointer_set_insert John David Anglin
@ 2012-12-16 17:11 ` Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2012-12-16 17:11 UTC (permalink / raw)
  To: John David Anglin; +Cc: gcc-patches

On Sun, Dec 16, 2012 at 5:33 PM, John David Anglin
<dave@hiauly1.hia.nrc.ca> wrote:
> The attached patch fixes a regression introduced on the trunk to
> fix PR middle-end/52640.  The fix was previously applied to the 4.6
> and 4.7 branches.
>
> Tested on hppa-unknown-linux-gnu with full bootstrap.
>
> OK for trunk?

Ok.

Thanks,
Richard.

> Dave
> --
> J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
> National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
>
> 2012-12-16  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
>
>         PR middle-end/55709
>         Forward port from 4.7 branch:
>         2012-04-10  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
>
>         PR middle-end/52894
>         * varasm.c (process_pending_assemble_externals): Set
>         pending_assemble_externals_processed true.
>         (assemble_external): Call assemble_external_real if the pending
>         assemble externals have been processed.
>
> Index: varasm.c
> ===================================================================
> --- varasm.c    (revision 194441)
> +++ varasm.c    (working copy)
> @@ -2088,6 +2088,11 @@
>     it all the way to final.  See PR 17982 for further discussion.  */
>  static GTY(()) tree pending_assemble_externals;
>
> +/* Some targets delay some output to final using TARGET_ASM_FILE_END.
> +   As a result, assemble_external can be called after the list of externals
> +   is processed and the pointer set destroyed.  */
> +static bool pending_assemble_externals_processed;
> +
>  #ifdef ASM_OUTPUT_EXTERNAL
>  /* Avoid O(external_decls**2) lookups in the pending_assemble_externals
>     TREE_LIST in assemble_external.  */
> @@ -2144,6 +2149,7 @@
>      assemble_external_real (TREE_VALUE (list));
>
>    pending_assemble_externals = 0;
> +  pending_assemble_externals_processed = true;
>    pointer_set_destroy (pending_assemble_externals_set);
>  #endif
>  }
> @@ -2196,6 +2202,12 @@
>      weak_decls = tree_cons (NULL, decl, weak_decls);
>
>  #ifdef ASM_OUTPUT_EXTERNAL
> +  if (pending_assemble_externals_processed)
> +    {
> +      assemble_external_real (decl);
> +      return;
> +    }
> +
>    if (! pointer_set_insert (pending_assemble_externals_set, decl))
>      pending_assemble_externals = tree_cons (NULL, decl,
>                                             pending_assemble_externals);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix Infinite loop in pointer_set_insert
@ 2012-12-16 19:39 Dominique Dhumieres
  0 siblings, 0 replies; 3+ messages in thread
From: Dominique Dhumieres @ 2012-12-16 19:39 UTC (permalink / raw)
  To: gcc-patches; +Cc: dave

> The attached patch fixes a regression introduced on the trunk to ...

This breaks bootstrap on x86_64-apple-darwin10:

../../work/gcc/varasm.c:2094:13: error: 'pending_assemble_externals_processed' defined but not used [-Werror=unused-variable]
 static bool pending_assemble_externals_processed;

I fixed it by moving

+/* Some targets delay some output to final using TARGET_ASM_FILE_END.
+   As a result, assemble_external can be called after the list of externals
+   is processed and the pointer set destroyed.  */
+static bool pending_assemble_externals_processed;
+

after

 #ifdef ASM_OUTPUT_EXTERNAL

instead of having it before.

TIA

Dominique

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-16 19:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-16 16:33 [PATCH] Fix Infinite loop in pointer_set_insert John David Anglin
2012-12-16 17:11 ` Richard Biener
2012-12-16 19:39 Dominique Dhumieres

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).