public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61012] New: lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function)
@ 2014-04-30 11:19 mliska at suse dot cz
  2014-05-21 16:44 ` [Bug lto/61012] [4.9/4.10 Regression] " hubicka at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mliska at suse dot cz @ 2014-04-30 11:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61012

            Bug ID: 61012
           Summary: lto1: errors during merging of translation units
                    (error: variable ‘link’ redeclared as function)
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mliska at suse dot cz

$ cat a.c
struct s
{
  int a;
  int b;
};

static struct s link = { 1, 2 };

int foo()
{
  return link.a;
}

$ cat b.c
#include <unistd.h>

int main()
{
  int r = link("aaa", "bbb");

  return foo();
}

$ gcc a.c b.c -flto -O2

/usr/include/unistd.h:812:12: error: variable ‘link’ redeclared as function
 extern int link (const char *__from, const char *__to)
            ^
a.c:7:17: note: previously declared here
 static struct s link = { 1, 2 };
                 ^
lto1: fatal error: errors during merging of translation units
compilation terminated.
lto-wrapper: gcc returned 1 exit status
/home/marxin/Programming/bin/gcc2/lib64/gcc/x86_64-unknown-linux-gnu/4.10.0/../../../../x86_64-unknown-linux-gnu/bin/ld:
fatal error: lto-wrapper failed
collect2: error: ld returned 1 exit status
>From gcc-bugs-return-450229-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Apr 30 11:23:58 2014
Return-Path: <gcc-bugs-return-450229-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18813 invoked by alias); 30 Apr 2014 11:23:57 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 18778 invoked by uid 55); 30 Apr 2014 11:23:54 -0000
From: "mircea.namolaru at inria dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/61000] No loop interchange for inner loop along the slow index
Date: Wed, 30 Apr 2014 11:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 4.10.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mircea.namolaru at inria dot fr
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61000-4-wE1LHZv3KI@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61000-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61000-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-04/txt/msg02249.txt.bz2
Content-length: 1743

http://gcc.gnu.org/bugzilla/show_bug.cgi?ida000

--- Comment #4 from Mircea Namolaru <mircea.namolaru at inria dot fr> ---
Right, C arrays expressed as pointers suffers from the same problem.
But for C at least there is a way to avoid this.

Many thanks for your suggestion of how to de-linearize arrays in middle-end, it
seems that may be simpler then I've thought. Hope to find time and wrote a
patch
based on your idea for GCC 4.10.

Mircea

----- Original Message -----
> From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
> To: "mircea namolaru" <mircea.namolaru@inria.fr>
> Sent: Wednesday, April 30, 2014 1:02:10 PM
> Subject: [Bug tree-optimization/61000] No loop interchange for inner loop along the slow index
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?ida000
>
> --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
> (In reply to Mircea Namolaru from comment #2)
> > Again, the problem is due to representation of arrays in Fortran as array
> > with a single dimnesion (for similar code in C profitability check work as
> > expected). It is a recurring problem that may lead to compilation time
> > increase (sometimes dramatically) or missed opportunities optimizations due
> > to too conservative dependence analysis or as on this case the
> > profitability
> > check failure. The solution is to de-liniarize array accesses in Fortran as
> > in C.
>
> Note that C doesn't always have de-linearized arrays (once you access the
> array via a pointer).
>
> For Fortran de-linearizing is "easy" via simple casting to a
> multi-dimensional
> (variable-bounds) array type.  For the middle-end side, that is.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>


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

* [Bug lto/61012] [4.9/4.10 Regression] lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function)
  2014-04-30 11:19 [Bug c++/61012] New: lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function) mliska at suse dot cz
@ 2014-05-21 16:44 ` hubicka at gcc dot gnu.org
  2014-05-22  5:36 ` hubicka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-05-21 16:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61012

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
It is LTO-symtab bug.  In this case we have chain with static var and external
decl and we find no prevailing symbol (correctly), but then instead of choosing
the external decl for further merging we go with static var as the loop forgets
to skip statics.

I am testing:

Index: lto-symtab.c
===================================================================
--- lto-symtab.c        (revision 210672)
+++ lto-symtab.c        (working copy)
@@ -453,7 +453,10 @@ lto_symtab_merge_decls_1 (symtab_node *f
      cgraph or a varpool node.  */
   if (!prevailing)
     {
-      prevailing = first;
+      for (prevailing = first;
+          prevailing; prevailing = prevailing->next_sharing_asm_name)
+       if (lto_symtab_symbol_p (prevailing))
+         break;
       /* For variables chose with a priority variant with vnode
         attached (i.e. from unit where external declaration of
         variable is actually used).


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

* [Bug lto/61012] [4.9/4.10 Regression] lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function)
  2014-04-30 11:19 [Bug c++/61012] New: lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function) mliska at suse dot cz
  2014-05-21 16:44 ` [Bug lto/61012] [4.9/4.10 Regression] " hubicka at gcc dot gnu.org
@ 2014-05-22  5:36 ` hubicka at gcc dot gnu.org
  2014-05-22  5:38 ` hubicka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-05-22  5:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61012

--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Author: hubicka
Date: Thu May 22 05:35:32 2014
New Revision: 210739

URL: http://gcc.gnu.org/viewcvs?rev=210739&root=gcc&view=rev
Log:

    PR lto/61012
    * lto-symtab.c (lto_symtab_merge_decls_1):

Modified:
    branches/gcc-4_9-branch/gcc/lto/ChangeLog
    branches/gcc-4_9-branch/gcc/lto/lto-symtab.c


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

* [Bug lto/61012] [4.9/4.10 Regression] lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function)
  2014-04-30 11:19 [Bug c++/61012] New: lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function) mliska at suse dot cz
  2014-05-21 16:44 ` [Bug lto/61012] [4.9/4.10 Regression] " hubicka at gcc dot gnu.org
  2014-05-22  5:36 ` hubicka at gcc dot gnu.org
@ 2014-05-22  5:38 ` hubicka at gcc dot gnu.org
  2014-05-22  5:41 ` hubicka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-05-22  5:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61012

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Author: hubicka
Date: Thu May 22 05:38:04 2014
New Revision: 210740

URL: http://gcc.gnu.org/viewcvs?rev=210740&root=gcc&view=rev
Log:

    PR lto/61012
    * lto-symtab.c (lto_symtab_merge_decls_1): Do not ICE on undefined
externals
    mixed with variables.

Modified:
    trunk/gcc/lto/ChangeLog
    trunk/gcc/lto/lto-symtab.c


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

* [Bug lto/61012] [4.9/4.10 Regression] lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function)
  2014-04-30 11:19 [Bug c++/61012] New: lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function) mliska at suse dot cz
                   ` (2 preceding siblings ...)
  2014-05-22  5:38 ` hubicka at gcc dot gnu.org
@ 2014-05-22  5:41 ` hubicka at gcc dot gnu.org
  2014-06-17  9:00 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-05-22  5:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61012

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Fixed.


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

* [Bug lto/61012] [4.9/4.10 Regression] lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function)
  2014-04-30 11:19 [Bug c++/61012] New: lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function) mliska at suse dot cz
                   ` (3 preceding siblings ...)
  2014-05-22  5:41 ` hubicka at gcc dot gnu.org
@ 2014-06-17  9:00 ` rguenth at gcc dot gnu.org
  2014-06-17  9:08 ` rguenth at gcc dot gnu.org
  2014-06-17  9:08 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-17  9:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61012

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |khimov at altell dot ru

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
*** Bug 61526 has been marked as a duplicate of this bug. ***


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

* [Bug lto/61012] [4.9/4.10 Regression] lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function)
  2014-04-30 11:19 [Bug c++/61012] New: lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function) mliska at suse dot cz
                   ` (4 preceding siblings ...)
  2014-06-17  9:00 ` rguenth at gcc dot gnu.org
@ 2014-06-17  9:08 ` rguenth at gcc dot gnu.org
  2014-06-17  9:08 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-17  9:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61012

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Jun 17 09:08:02 2014
New Revision: 211729

URL: https://gcc.gnu.org/viewcvs?rev=211729&root=gcc&view=rev
Log:
2014-06-17  Richard Biener  <rguenther@suse.de>

    PR lto/61012
    * gcc.dg/lto/pr61526_0.c: New testcase.
    * gcc.dg/lto/pr61526_1.c: Likewise.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/lto/pr61526_0.c
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/lto/pr61526_1.c
Modified:
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


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

* [Bug lto/61012] [4.9/4.10 Regression] lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function)
  2014-04-30 11:19 [Bug c++/61012] New: lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function) mliska at suse dot cz
                   ` (5 preceding siblings ...)
  2014-06-17  9:08 ` rguenth at gcc dot gnu.org
@ 2014-06-17  9:08 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-17  9:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61012

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Tue Jun 17 09:07:41 2014
New Revision: 211728

URL: https://gcc.gnu.org/viewcvs?rev=211728&root=gcc&view=rev
Log:
2014-06-17  Richard Biener  <rguenther@suse.de>

    PR lto/61012
    * gcc.dg/lto/pr61526_0.c: New testcase.
    * gcc.dg/lto/pr61526_1.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/lto/pr61526_0.c
    trunk/gcc/testsuite/gcc.dg/lto/pr61526_1.c
Modified:
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2014-06-17  9:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-30 11:19 [Bug c++/61012] New: lto1: errors during merging of translation units (error: variable ‘link’ redeclared as function) mliska at suse dot cz
2014-05-21 16:44 ` [Bug lto/61012] [4.9/4.10 Regression] " hubicka at gcc dot gnu.org
2014-05-22  5:36 ` hubicka at gcc dot gnu.org
2014-05-22  5:38 ` hubicka at gcc dot gnu.org
2014-05-22  5:41 ` hubicka at gcc dot gnu.org
2014-06-17  9:00 ` rguenth at gcc dot gnu.org
2014-06-17  9:08 ` rguenth at gcc dot gnu.org
2014-06-17  9:08 ` rguenth at gcc dot gnu.org

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).