Patchwork better error message for multiple prevailing defs

login
register
mail settings
Submitter Andi Kleen
Date July 12, 2010, 8:30 a.m.
Message ID <87eif9m79g.fsf@basil.nowhere.org>
Download mbox | patch
Permalink /patch/58581/
State New
Headers show

Comments

Andi Kleen - July 12, 2010, 8:30 a.m.
Andi Kleen <andi@firstfloor.org> writes:


Final updated version of the patch. The earlier version
had inverted tests :/

-Andi

2010-07-11  Andi Kleen  <ak@linux.intel.com>
    
    	* lto-symtab.c (lto_symtab_merge_decls_1): Use fatal_error
    	instead of gcc_assert to print better error message for multiple
    	prevailing defs.
Richard Guenther - July 12, 2010, 8:35 a.m.
On Mon, Jul 12, 2010 at 10:30 AM, Andi Kleen <andi@firstfloor.org> wrote:
> Andi Kleen <andi@firstfloor.org> writes:
>
>
> Final updated version of the patch. The earlier version
> had inverted tests :/

Ok and committed.  Please get yourself svn write access, you can
use me as a sponsor.

Thanks,
Richard.

> -Andi
>
> 2010-07-11  Andi Kleen  <ak@linux.intel.com>
>
>        * lto-symtab.c (lto_symtab_merge_decls_1): Use fatal_error
>        instead of gcc_assert to print better error message for multiple
>        prevailing defs.
>
> diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c
> index d101449..6eaf22c 100644
> --- a/gcc/lto-symtab.c
> +++ b/gcc/lto-symtab.c
> @@ -648,9 +648,13 @@ lto_symtab_merge_decls_1 (void **slot, void *data ATTRIBUTE_UNUSED)
>
>   /* Assert it's the only one.  */
>   if (prevailing)
> -    for (e = prevailing->next; e; e = e->next)
> -      gcc_assert (e->resolution != LDPR_PREVAILING_DEF_IRONLY
> -                 && e->resolution != LDPR_PREVAILING_DEF);
> +      for (e = prevailing->next; e; e = e->next)
> +       {
> +         if (e->resolution == LDPR_PREVAILING_DEF_IRONLY
> +             || e->resolution == LDPR_PREVAILING_DEF)
> +           fatal_error ("multiple prevailing defs for %qE",
> +                        DECL_NAME (prevailing->decl));
> +       }
>
>   /* If there's not a prevailing symbol yet it's an external reference.
>      Happens a lot during ltrans.  Choose the first symbol with a
>
>
>

Patch

diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c
index d101449..6eaf22c 100644
--- a/gcc/lto-symtab.c
+++ b/gcc/lto-symtab.c
@@ -648,9 +648,13 @@  lto_symtab_merge_decls_1 (void **slot, void *data ATTRIBUTE_UNUSED)
 
   /* Assert it's the only one.  */
   if (prevailing)
-    for (e = prevailing->next; e; e = e->next)
-      gcc_assert (e->resolution != LDPR_PREVAILING_DEF_IRONLY
-		  && e->resolution != LDPR_PREVAILING_DEF);
+      for (e = prevailing->next; e; e = e->next)
+	{
+	  if (e->resolution == LDPR_PREVAILING_DEF_IRONLY
+	      || e->resolution == LDPR_PREVAILING_DEF)
+	    fatal_error ("multiple prevailing defs for %qE", 
+			 DECL_NAME (prevailing->decl));
+	}
 
   /* If there's not a prevailing symbol yet it's an external reference.
      Happens a lot during ltrans.  Choose the first symbol with a