public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14936] New: -fdata-sections + uninitialized template data objects = spurious link errors
@ 2004-04-13 10:11 zack at gcc dot gnu dot org
  2004-04-13 12:45 ` [Bug c++/14936] [3.4/3.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: zack at gcc dot gnu dot org @ 2004-04-13 10:11 UTC (permalink / raw)
  To: gcc-bugs

Consider the following code fragment:

  template <typename T> struct S { static int i; };
  template <typename T> int S<T>::i;
  int j = S<double>::i;

When compiled normally, the variable S<double>::i is emitted as 

        .comm   _ZN1SIdE1iE,4,4

which is fine.  When compiled with -fdata-sections on an ELF target, however,
the same symbol is emitted in its own .bss subsection, like this:

        .globl _ZN1SIdE1iE
        .section        .bss._ZN1SIdE1iE,"aw",@nobits
        .align 4
        .type   _ZN1SIdE1iE,@object
        .size   _ZN1SIdE1iE,4
_ZN1SIdE1iE:
        .zero   4

This causes a multiple-definition error from the linker if two source files
instantiate S<double> and are compiled with -fdata-sections.  A linkonce section
should be used instead, as is done if S<T>::i is initialized.

-- 
           Summary: -fdata-sections + uninitialized template data objects =
                    spurious link errors
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zack at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/14936] [3.4/3.3 Regression] -fdata-sections + uninitialized template data objects = spurious link errors
  2004-04-13 10:11 [Bug c++/14936] New: -fdata-sections + uninitialized template data objects = spurious link errors zack at gcc dot gnu dot org
@ 2004-04-13 12:45 ` pinskia at gcc dot gnu dot org
  2004-04-14 22:08 ` [Bug c++/14936] [3.3/3.4 " cvs-commit at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-13 12:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-13 11:26 -------
The mainline gives:
        .section        .gnu.linkonce.b._ZN1SIdE1iE,"aw",@nobits
        .align 4
        .type   _ZN1SIdE1iE, @object
        .size   _ZN1SIdE1iE, 4
_ZN1SIdE1iE:

While 3.4.0 and 3.3.3 gives:
.globl _ZN1SIdE1iE
        .section        .bss._ZN1SIdE1iE,"aw",@nobits
        .align 4
        .type   _ZN1SIdE1iE, @object
        .size   _ZN1SIdE1iE, 4
_ZN1SIdE1iE:

3.2.3 did not put it into its own section:
        .comm   _ZN1SIdE1iE,4,4

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
      Known to fail|                            |3.3.3 3.4.0
      Known to work|                            |3.5.0 3.2.3
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-13 11:26:15
               date|                            |
            Summary|-fdata-sections +           |[3.4/3.3 Regression] -fdata-
                   |uninitialized template data |sections + uninitialized
                   |objects = spurious link     |template data objects =
                   |errors                      |spurious link errors
   Target Milestone|---                         |3.3.4


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


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

* [Bug c++/14936] [3.3/3.4 Regression] -fdata-sections + uninitialized template data objects = spurious link errors
  2004-04-13 10:11 [Bug c++/14936] New: -fdata-sections + uninitialized template data objects = spurious link errors zack at gcc dot gnu dot org
  2004-04-13 12:45 ` [Bug c++/14936] [3.4/3.3 Regression] " pinskia at gcc dot gnu dot org
@ 2004-04-14 22:08 ` cvs-commit at gcc dot gnu dot org
  2004-04-14 22:22 ` [Bug c++/14936] [3.3 " zack at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-04-14 22:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-04-14 21:14 -------
Subject: Bug 14936

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	zack@gcc.gnu.org	2004-04-14 21:14:15

Modified files:
	gcc            : ChangeLog varasm.c 

Log message:
	PR 14936
	Backport from mainline:
	2004-03-12  Matt Austern  <austern@apple.com>
	
	* varasm.c (make_decl_one_only): Don't use DECL_COMMON if
	we're compiling for a SUPPORTS_ONE_ONLY target.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.389&r2=2.2326.2.390
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.405.2.2&r2=1.405.2.3



-- 


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


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

* [Bug c++/14936] [3.3 Regression] -fdata-sections + uninitialized template data objects = spurious link errors
  2004-04-13 10:11 [Bug c++/14936] New: -fdata-sections + uninitialized template data objects = spurious link errors zack at gcc dot gnu dot org
  2004-04-13 12:45 ` [Bug c++/14936] [3.4/3.3 Regression] " pinskia at gcc dot gnu dot org
  2004-04-14 22:08 ` [Bug c++/14936] [3.3/3.4 " cvs-commit at gcc dot gnu dot org
@ 2004-04-14 22:22 ` zack at gcc dot gnu dot org
  2004-04-14 23:13 ` zack at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: zack at gcc dot gnu dot org @ 2004-04-14 22:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at gcc dot gnu dot org  2004-04-14 21:21 -------
Gabriel, do you want this fix for 3.3.4

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
      Known to fail|3.3.3 3.4.0                 |3.3.3
      Known to work|3.5.0 3.2.3                 |3.5.0 3.4.0 3.2.3
   Last reconfirmed|2004-04-13 11:26:15         |2004-04-14 21:21:07
               date|                            |
            Summary|[3.3/3.4 Regression] -fdata-|[3.3 Regression] -fdata-
                   |sections + uninitialized    |sections + uninitialized
                   |template data objects =     |template data objects =
                   |spurious link errors        |spurious link errors


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


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

* [Bug c++/14936] [3.3 Regression] -fdata-sections + uninitialized template data objects = spurious link errors
  2004-04-13 10:11 [Bug c++/14936] New: -fdata-sections + uninitialized template data objects = spurious link errors zack at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-04-14 22:22 ` [Bug c++/14936] [3.3 " zack at gcc dot gnu dot org
@ 2004-04-14 23:13 ` zack at gcc dot gnu dot org
  2004-04-14 23:35 ` gdr at integrable-solutions dot net
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: zack at gcc dot gnu dot org @ 2004-04-14 23:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at gcc dot gnu dot org  2004-04-14 21:21 -------
/me kicks bugzilla

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |zack at gcc dot gnu dot org
                   |dot org                     |


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


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

* [Bug c++/14936] [3.3 Regression] -fdata-sections + uninitialized template data objects = spurious link errors
  2004-04-13 10:11 [Bug c++/14936] New: -fdata-sections + uninitialized template data objects = spurious link errors zack at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-04-14 23:13 ` zack at gcc dot gnu dot org
@ 2004-04-14 23:35 ` gdr at integrable-solutions dot net
  2004-04-15  2:25 ` cvs-commit at gcc dot gnu dot org
  2004-04-15  5:10 ` zack at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-04-14 23:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-04-14 23:20 -------
Subject: Re:  [3.3 Regression] -fdata-sections + uninitialized template data objects = spurious link errors

"zack at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| Gabriel, do you want this fix for 3.3.4

Yes, thanks!

-- Gaby


-- 


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


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

* [Bug c++/14936] [3.3 Regression] -fdata-sections + uninitialized template data objects = spurious link errors
  2004-04-13 10:11 [Bug c++/14936] New: -fdata-sections + uninitialized template data objects = spurious link errors zack at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-04-14 23:35 ` gdr at integrable-solutions dot net
@ 2004-04-15  2:25 ` cvs-commit at gcc dot gnu dot org
  2004-04-15  5:10 ` zack at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-04-15  2:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-04-15 02:05 -------
Subject: Bug 14936

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	zack@gcc.gnu.org	2004-04-15 02:05:06

Modified files:
	gcc            : ChangeLog varasm.c 

Log message:
	PR 14936
	Backport from mainline:
	2004-03-12  Matt Austern  <austern@apple.com>
	
	* varasm.c (make_decl_one_only): Don't use DECL_COMMON if
	we're compiling for a SUPPORTS_ONE_ONLY target.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.967&r2=1.16114.2.968
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.324.2.10&r2=1.324.2.11



-- 


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


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

* [Bug c++/14936] [3.3 Regression] -fdata-sections + uninitialized template data objects = spurious link errors
  2004-04-13 10:11 [Bug c++/14936] New: -fdata-sections + uninitialized template data objects = spurious link errors zack at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-04-15  2:25 ` cvs-commit at gcc dot gnu dot org
@ 2004-04-15  5:10 ` zack at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: zack at gcc dot gnu dot org @ 2004-04-15  5:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at gcc dot gnu dot org  2004-04-15 03:41 -------
now fixed in 3.3 branch too.

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


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


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

end of thread, other threads:[~2004-04-15  3:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-13 10:11 [Bug c++/14936] New: -fdata-sections + uninitialized template data objects = spurious link errors zack at gcc dot gnu dot org
2004-04-13 12:45 ` [Bug c++/14936] [3.4/3.3 Regression] " pinskia at gcc dot gnu dot org
2004-04-14 22:08 ` [Bug c++/14936] [3.3/3.4 " cvs-commit at gcc dot gnu dot org
2004-04-14 22:22 ` [Bug c++/14936] [3.3 " zack at gcc dot gnu dot org
2004-04-14 23:13 ` zack at gcc dot gnu dot org
2004-04-14 23:35 ` gdr at integrable-solutions dot net
2004-04-15  2:25 ` cvs-commit at gcc dot gnu dot org
2004-04-15  5:10 ` zack at gcc dot gnu dot 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).