public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/56297] New: LTO: multiple definition error with global register variables
@ 2013-02-12 12:33 d.g.gorbachev at gmail dot com
  2013-02-12 13:39 ` [Bug lto/56297] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: d.g.gorbachev at gmail dot com @ 2013-02-12 12:33 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56297
           Summary: LTO: multiple definition error with global register
                    variables
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: d.g.gorbachev@gmail.com


Created attachment 29424
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29424
Testcase

This testcase causes "multiple definition of 'esp'" error (note that esp has a
fixed role, there is no need to reserve it).


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

* [Bug lto/56297] LTO: multiple definition error with global register variables
  2013-02-12 12:33 [Bug lto/56297] New: LTO: multiple definition error with global register variables d.g.gorbachev at gmail dot com
@ 2013-02-12 13:39 ` rguenth at gcc dot gnu.org
  2013-02-12 13:47 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-12 13:39 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-02-12
                 CC|                            |hubicka at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-12 13:39:15 UTC ---
Confirmed.  We put

register int i asm ("esp");

into the LTO symbol table.  Oops.  The GCC symtab and the partition contains

(gdb) call debug_symtab_node (node)
*esp/0 (*esp) @0x7ffff6e1a068
  Type: variable
  Visibility: force_output public
  References: 
  Referring: main/1 (read)
  Availability: overwritable
  Varpool flags: analyzed finalized

not sure if we want to put global hardregs into the symtab at all ...
(certainly not in the LTO symbol table we feed to the linker).
Thus, maybe

Index: gcc/lto-streamer-out.c
===================================================================
--- gcc/lto-streamer-out.c      (revision 195973)
+++ gcc/lto-streamer-out.c      (working copy)
@@ -1166,7 +1166,8 @@ write_symbol (struct streamer_tree_cache
   if (!TREE_PUBLIC (t)
       || is_builtin_fn (t)
       || DECL_ABSTRACT (t)
-      || TREE_CODE (t) == RESULT_DECL)
+      || TREE_CODE (t) == RESULT_DECL
+      || (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t)))
     return;

   gcc_assert (TREE_CODE (t) == VAR_DECL

?  At least it "works" with that change.

Testing it.


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

* [Bug lto/56297] LTO: multiple definition error with global register variables
  2013-02-12 12:33 [Bug lto/56297] New: LTO: multiple definition error with global register variables d.g.gorbachev at gmail dot com
  2013-02-12 13:39 ` [Bug lto/56297] " rguenth at gcc dot gnu.org
@ 2013-02-12 13:47 ` rguenth at gcc dot gnu.org
  2013-02-12 15:15 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-12 13:47 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-12 13:46:52 UTC ---
GCC 4.7 says

/tmp/ccQAPnYJ.o (symbol from plugin): In function `esp':
(.text+0x0): multiple definition of `esp'
/tmp/ccihIbJc.o (symbol from plugin):(.text+0x0): first defined here
In file included from foo.c:6:0,
                 from :0:
bar.c:1:14: warning: register of 'i' used for multiple global register
variables [enabled by default]
In file included from :0:0:
foo.c:1:14: note: conflicts with 'i'
collect2: error: ld returned 1 exit status

with trunk we lost that (bogus) warning.  Even when using two different
variable names.


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

* [Bug lto/56297] LTO: multiple definition error with global register variables
  2013-02-12 12:33 [Bug lto/56297] New: LTO: multiple definition error with global register variables d.g.gorbachev at gmail dot com
  2013-02-12 13:39 ` [Bug lto/56297] " rguenth at gcc dot gnu.org
  2013-02-12 13:47 ` rguenth at gcc dot gnu.org
@ 2013-02-12 15:15 ` rguenth at gcc dot gnu.org
  2013-02-12 15:16 ` rguenth at gcc dot gnu.org
  2013-02-12 16:24 ` hubicka at ucw dot cz
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-12 15:15 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-12 15:14:37 UTC ---
Author: rguenth
Date: Tue Feb 12 15:14:32 2013
New Revision: 195979

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195979
Log:
2013-02-12  Richard Biener  <rguenther@suse.de>

    PR lto/56297
    * lto-streamer-out.c (write_symbol): Do not output symbols
    for hard register variables.

    * gcc.dg/lto/pr56297_0.c: New testcase.
    * gcc.dg/lto/pr56297_0.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/lto/pr56297_0.c
    trunk/gcc/testsuite/gcc.dg/lto/pr56297_1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lto-streamer-out.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug lto/56297] LTO: multiple definition error with global register variables
  2013-02-12 12:33 [Bug lto/56297] New: LTO: multiple definition error with global register variables d.g.gorbachev at gmail dot com
                   ` (2 preceding siblings ...)
  2013-02-12 15:15 ` rguenth at gcc dot gnu.org
@ 2013-02-12 15:16 ` rguenth at gcc dot gnu.org
  2013-02-12 16:24 ` hubicka at ucw dot cz
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-02-12 15:16 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-12 15:16:11 UTC ---
Fixed for 4.8.


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

* [Bug lto/56297] LTO: multiple definition error with global register variables
  2013-02-12 12:33 [Bug lto/56297] New: LTO: multiple definition error with global register variables d.g.gorbachev at gmail dot com
                   ` (3 preceding siblings ...)
  2013-02-12 15:16 ` rguenth at gcc dot gnu.org
@ 2013-02-12 16:24 ` hubicka at ucw dot cz
  4 siblings, 0 replies; 6+ messages in thread
From: hubicka at ucw dot cz @ 2013-02-12 16:24 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Jan Hubicka <hubicka at ucw dot cz> 2013-02-12 16:23:37 UTC ---
> Confirmed.  We put
> 
> register int i asm ("esp");
> 
> into the LTO symbol table.  Oops.  The GCC symtab and the partition contains
> 
> (gdb) call debug_symtab_node (node)
> *esp/0 (*esp) @0x7ffff6e1a068
>   Type: variable
>   Visibility: force_output public
>   References: 
>   Referring: main/1 (read)
>   Availability: overwritable
>   Varpool flags: analyzed finalized
> 
> not sure if we want to put global hardregs into the symtab at all ...
> (certainly not in the LTO symbol table we feed to the linker).
> Thus, maybe
> 
> Index: gcc/lto-streamer-out.c
> ===================================================================
> --- gcc/lto-streamer-out.c      (revision 195973)
> +++ gcc/lto-streamer-out.c      (working copy)
> @@ -1166,7 +1166,8 @@ write_symbol (struct streamer_tree_cache
>    if (!TREE_PUBLIC (t)
>        || is_builtin_fn (t)
>        || DECL_ABSTRACT (t)
> -      || TREE_CODE (t) == RESULT_DECL)
> +      || TREE_CODE (t) == RESULT_DECL
> +      || (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t)))
>      return;
> 
>    gcc_assert (TREE_CODE (t) == VAR_DECL
> 
> ?  At least it "works" with that change.
> 
> Testing it.

Yeah, I suppose we ought to put those out of symbol table for 4.9. I have local
patch for that.

Honza


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

end of thread, other threads:[~2013-02-12 16:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-12 12:33 [Bug lto/56297] New: LTO: multiple definition error with global register variables d.g.gorbachev at gmail dot com
2013-02-12 13:39 ` [Bug lto/56297] " rguenth at gcc dot gnu.org
2013-02-12 13:47 ` rguenth at gcc dot gnu.org
2013-02-12 15:15 ` rguenth at gcc dot gnu.org
2013-02-12 15:16 ` rguenth at gcc dot gnu.org
2013-02-12 16:24 ` hubicka at ucw dot cz

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