From patchwork Sun Jul 11 10:29:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: better error message for multiple prevailing defs From: Andi Kleen X-Patchwork-Id: 58520 Message-Id: <20100711102940.GA7341@basil.fritz.box> To: Richard Guenther Cc: Andi Kleen , gcc-patches@gcc.gnu.org Date: Sun, 11 Jul 2010 12:29:40 +0200 On Sun, Jul 11, 2010 at 11:59:29AM +0200, Richard Guenther wrote: > On Sun, Jul 11, 2010 at 10:19 AM, Andi Kleen wrote: > > I have some trouble with the linker providing multiple prevailing > > definitions for a single LTO symbol. Right now it's difficult > > to find out which symbol this even is, can be only done with the > > debugger. Fix the error message to print out the symbol. > > > > I have no svn account, so someone would need to commit it for me. > > > > -Andi > > > > 2010-07-11  Andi Kleen   > > > >        * lto-symtab.c (lto_symtab_merge_decls_1): Use internal_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..c907723 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) > > +           internal_error ("multiple prevailing defs for %qE", > > +                           DECL_NAME (prevailing->decl)); > > I'd say using fatal_error () here is more appropriate. Updated patch with fatal error. -Andi 2010-07-11 Andi Kleen * 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..c907723 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