public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/41090]  New: Using static label reference in c++ class constructor produces wrong code
@ 2009-08-17 13:54 mark at gcc dot gnu dot org
  2009-08-17 14:21 ` [Bug c++/41090] " dodji at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: mark at gcc dot gnu dot org @ 2009-08-17 13:54 UTC (permalink / raw)
  To: gcc-bugs

The following code compiles, but won't link:

#include <iostream>
using namespace std;

class C
{
public:
  C()
  {
    static void *labelref = &&label;
    goto *labelref;
    label: cout << "hello" << endl;
  }
}; 

int
main (int argc, char **argv)
{
  C inst = C();
  return 0;
}

$ g++ label.cxx 
/tmp/ccirWO3W.o:(.data._ZZN1CC1EvE8labelref[C::C()::labelref]+0x0): undefined
reference to `.L11'
collect2: ld returned 1 exit status


-- 
           Summary: Using static label reference in c++ class constructor
                    produces wrong code
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mark at gcc dot gnu dot org


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


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

* [Bug c++/41090] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
@ 2009-08-17 14:21 ` dodji at gcc dot gnu dot org
  2009-08-17 14:27 ` mikpe at it dot uu dot se
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: dodji at gcc dot gnu dot org @ 2009-08-17 14:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dodji at gcc dot gnu dot org  2009-08-17 14:21 -------
Confirmed in trunk as well.


-- 

dodji at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dodji at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-08-17 14:21:06
               date|                            |


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


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

* [Bug c++/41090] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
  2009-08-17 14:21 ` [Bug c++/41090] " dodji at gcc dot gnu dot org
@ 2009-08-17 14:27 ` mikpe at it dot uu dot se
  2009-09-18  5:15 ` [Bug c++/41090] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: mikpe at it dot uu dot se @ 2009-08-17 14:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from mikpe at it dot uu dot se  2009-08-17 14:26 -------
Similar linkage error occurs with gcc-4.3.4.


-- 


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


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

* [Bug c++/41090] [4.3/4.4/4.5 Regression] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
  2009-08-17 14:21 ` [Bug c++/41090] " dodji at gcc dot gnu dot org
  2009-08-17 14:27 ` mikpe at it dot uu dot se
@ 2009-09-18  5:15 ` pinskia at gcc dot gnu dot org
  2009-09-18  9:03 ` rguenth at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-09-18  5:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-09-18 05:14 -------
Confirmed, 3.3 used to work.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |assemble-failure, link-
                   |                            |failure
      Known to fail|                            |4.0.1 4.4.0 4.5.0
      Known to work|                            |3.3
            Summary|Using static label reference|[4.3/4.4/4.5 Regression]
                   |in c++ class constructor    |Using static label reference
                   |produces wrong code         |in c++ class constructor
                   |                            |produces wrong code
   Target Milestone|---                         |4.3.5


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


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

* [Bug c++/41090] [4.3/4.4/4.5 Regression] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-09-18  5:15 ` [Bug c++/41090] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
@ 2009-09-18  9:03 ` rguenth at gcc dot gnu dot org
  2009-09-28 21:38 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-09-18  9:03 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug c++/41090] [4.3/4.4/4.5 Regression] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-09-18  9:03 ` rguenth at gcc dot gnu dot org
@ 2009-09-28 21:38 ` pinskia at gcc dot gnu dot org
  2009-11-09 22:44 ` jason at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-09-28 21:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-09-28 21:37 -------
Hmm, this is harder than I thought it would be.  The issue is we have only one
labelref but really two label.

I don't know if we can support this with the way cloning is done ...


-- 


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


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

* [Bug c++/41090] [4.3/4.4/4.5 Regression] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-09-28 21:38 ` pinskia at gcc dot gnu dot org
@ 2009-11-09 22:44 ` jason at gcc dot gnu dot org
  2010-01-29 17:20 ` jason at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-09 22:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jason at gcc dot gnu dot org  2009-11-09 22:43 -------
Yeah, there's no way to get this right in general with our unconditional
cloning.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |3187


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


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

* [Bug c++/41090] [4.3/4.4/4.5 Regression] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-11-09 22:44 ` jason at gcc dot gnu dot org
@ 2010-01-29 17:20 ` jason at gcc dot gnu dot org
  2010-02-03  0:08 ` jason at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-01-29 17:20 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-08-17 14:21:06         |2010-01-29 17:20:04
               date|                            |


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


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

* [Bug c++/41090] [4.3/4.4/4.5 Regression] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-01-29 17:20 ` jason at gcc dot gnu dot org
@ 2010-02-03  0:08 ` jason at gcc dot gnu dot org
  2010-02-03  1:15 ` jason at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-02-03  0:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jason at gcc dot gnu dot org  2010-02-03 00:08 -------
Subject: Bug 41090

Author: jason
Date: Wed Feb  3 00:07:49 2010
New Revision: 156455

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156455
Log:
        PR c++/41090
        * decl.c (cp_finish_decl): Add local statics to cfun->local_decls.
        * optimize.c (clone_body): Remap their initializers when making base
        variants.
        (maybe_clone_body): Complain if multiple clones aren't safe.

Added:
    trunk/gcc/testsuite/g++.dg/ext/label13.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/optimize.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/41090] [4.3/4.4/4.5 Regression] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2010-02-03  0:08 ` jason at gcc dot gnu dot org
@ 2010-02-03  1:15 ` jason at gcc dot gnu dot org
  2010-02-04 23:36 ` howarth at nitro dot med dot uc dot edu
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-02-03  1:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jason at gcc dot gnu dot org  2010-02-03 01:14 -------
The testcase now works, but a variant that uses virtual inheritance does not:

int i;
struct A { A() {} };
struct C: virtual A
{
  C();
};

C::C()
{
  static void *labelref = &&label;
  goto *labelref;
 label: i = 1;
}

int main()
{
  C c;
}

Unassigning myself now.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org
         AssignedTo|jason at gcc dot gnu dot org|unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug c++/41090] [4.3/4.4/4.5 Regression] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2010-02-03  1:15 ` jason at gcc dot gnu dot org
@ 2010-02-04 23:36 ` howarth at nitro dot med dot uc dot edu
  2010-02-05  1:41 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: howarth at nitro dot med dot uc dot edu @ 2010-02-04 23:36 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1885 bytes --]



------- Comment #8 from howarth at nitro dot med dot uc dot edu  2010-02-04 23:35 -------
The new g++.dg/ext/label13.C testcase fails on *-apple-darwin*. On
x86_64-apple-darwin10, the error message is...

/sw/src/fink.build/gcc45-4.4.999-20100203/darwin_objdir/gcc/testsuite/g++/../../g++
-B/sw/src/fink.build/gcc45-4.4.999-20100203/darwin_objdir/gcc/testsuite/g++/../../
/sw/src/fink.build/gcc45-4.4.999-20100203/gcc-4.5-20100203/gcc/testsuite/g++.dg/ext/label13.C
 -nostdinc++
-I/sw/src/fink.build/gcc45-4.4.999-20100203/darwin_objdir/x86_64-apple-darwin10.3.0/libstdc++-v3/include/x86_64-apple-darwin10.3.0
-I/sw/src/fink.build/gcc45-4.4.999-20100203/darwin_objdir/x86_64-apple-darwin10.3.0/libstdc++-v3/include
-I/sw/src/fink.build/gcc45-4.4.999-20100203/gcc-4.5-20100203/libstdc++-v3/libsupc++
-I/sw/src/fink.build/gcc45-4.4.999-20100203/gcc-4.5-20100203/libstdc++-v3/include/backward
-I/sw/src/fink.build/gcc45-4.4.999-20100203/gcc-4.5-20100203/libstdc++-v3/testsuite/util
-fmessage-length=0     
-L/sw/src/fink.build/gcc45-4.4.999-20100203/darwin_objdir/x86_64-apple-darwin10.3.0/./libstdc++-v3/src/.libs

-B/sw/src/fink.build/gcc45-4.4.999-20100203/darwin_objdir/x86_64-apple-darwin10.3.0/./libstdc++-v3/src/.libs

-L/sw/src/fink.build/gcc45-4.4.999-20100203/darwin_objdir/x86_64-apple-darwin10.3.0/./libstdc++-v3/src/.libs
-L/sw/src/fink.build/gcc45-4.4.999-20100203/darwin_objdir/x86_64-apple-darwin10.3.0/./libiberty
 -multiply_defined suppress -lm   -o ./label13.exe 
/sw/src/fink.build/gcc45-4.4.999-20100203/gcc-4.5-20100203/gcc/testsuite/g++.dg/ext/label13.C:
In constructor ‘C::C()’:
/sw/src/fink.build/gcc45-4.4.999-20100203/gcc-4.5-20100203/gcc/testsuite/g++.dg/ext/label13.C:8:3:
sorry, unimplemented: function ‘C::C()’ can never be copied because it saves
address of local label in a static variable


-- 


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


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

* [Bug c++/41090] [4.3/4.4/4.5 Regression] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2010-02-04 23:36 ` howarth at nitro dot med dot uc dot edu
@ 2010-02-05  1:41 ` jason at gcc dot gnu dot org
  2010-03-02 19:40 ` mrs at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-02-05  1:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jason at gcc dot gnu dot org  2010-02-05 01:41 -------
Ah, I guess we don't support the same body alias optimization on darwin, so the
testcase should be restricted to targets that do support it.


-- 


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


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

* [Bug c++/41090] [4.3/4.4/4.5 Regression] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2010-02-05  1:41 ` jason at gcc dot gnu dot org
@ 2010-03-02 19:40 ` mrs at gcc dot gnu dot org
  2010-05-22 18:34 ` [Bug c++/41090] [4.3/4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
  2010-06-19  0:28 ` danglin at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: mrs at gcc dot gnu dot org @ 2010-03-02 19:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from mrs at gcc dot gnu dot org  2010-03-02 19:40 -------
Subject: Bug 41090

Author: mrs
Date: Tue Mar  2 19:40:02 2010
New Revision: 157172

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157172
Log:
        PR c++/41090
        * g++.dg/ext/label13.C (C::C): xfail for darwin for now.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/ext/label13.C


-- 


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


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

* [Bug c++/41090] [4.3/4.4/4.5/4.6 Regression] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2010-03-02 19:40 ` mrs at gcc dot gnu dot org
@ 2010-05-22 18:34 ` rguenth at gcc dot gnu dot org
  2010-06-19  0:28 ` danglin at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-22 18:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from rguenth at gcc dot gnu dot org  2010-05-22 18:13 -------
GCC 4.3.5 is being released, adjusting target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.5                       |4.3.6


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


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

* [Bug c++/41090] [4.3/4.4/4.5/4.6 Regression] Using static label reference in c++ class constructor produces wrong code
  2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2010-05-22 18:34 ` [Bug c++/41090] [4.3/4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
@ 2010-06-19  0:28 ` danglin at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: danglin at gcc dot gnu dot org @ 2010-06-19  0:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from danglin at gcc dot gnu dot org  2010-06-19 00:28 -------
Subject: Bug 41090

Author: danglin
Date: Sat Jun 19 00:28:18 2010
New Revision: 161018

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161018
Log:
        PR c++/41090
        * g++.dg/ext/label13.C: xfail on 32-bit hppa*-*-hpux*.


Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/ext/label13.C


-- 


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


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

end of thread, other threads:[~2010-06-19  0:28 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-17 13:54 [Bug c++/41090] New: Using static label reference in c++ class constructor produces wrong code mark at gcc dot gnu dot org
2009-08-17 14:21 ` [Bug c++/41090] " dodji at gcc dot gnu dot org
2009-08-17 14:27 ` mikpe at it dot uu dot se
2009-09-18  5:15 ` [Bug c++/41090] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
2009-09-18  9:03 ` rguenth at gcc dot gnu dot org
2009-09-28 21:38 ` pinskia at gcc dot gnu dot org
2009-11-09 22:44 ` jason at gcc dot gnu dot org
2010-01-29 17:20 ` jason at gcc dot gnu dot org
2010-02-03  0:08 ` jason at gcc dot gnu dot org
2010-02-03  1:15 ` jason at gcc dot gnu dot org
2010-02-04 23:36 ` howarth at nitro dot med dot uc dot edu
2010-02-05  1:41 ` jason at gcc dot gnu dot org
2010-03-02 19:40 ` mrs at gcc dot gnu dot org
2010-05-22 18:34 ` [Bug c++/41090] [4.3/4.4/4.5/4.6 " rguenth at gcc dot gnu dot org
2010-06-19  0:28 ` danglin 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).