public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39095] [4.4 Regression] Mangling changes break ABI
  2009-02-04 10:58 [Bug c++/39095] New: [4.4 Regression] Mangling changes break ABI jakub at gcc dot gnu dot org
@ 2009-02-04 10:58 ` jakub at gcc dot gnu dot org
  2009-02-04 13:03 ` pedro dot lamarao at mndfck dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-04 10:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
   Target Milestone|---                         |4.4.0


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


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

* [Bug c++/39095]  New: [4.4 Regression] Mangling changes break ABI
@ 2009-02-04 10:58 jakub at gcc dot gnu dot org
  2009-02-04 10:58 ` [Bug c++/39095] " jakub at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-04 10:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140916
seems to break ABI, e.g. 4.4 compiled digikam can't be linked against 4.3
compiled libraries.
struct B
{
  int b;
};

B b;

struct A
{
  B *operator->() const
  {
    return &b;
  }
  A () {}
};

A a;

int foo ()
{
  return a->b;
}

is mangled as _ZNK1AptEv in g++ 4.3 and below, but as
_ZNK1AdtEv in g++ 4.4.


-- 
           Summary: [4.4 Regression] Mangling changes break ABI
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: ABI
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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

* [Bug c++/39095] [4.4 Regression] Mangling changes break ABI
  2009-02-04 10:58 [Bug c++/39095] New: [4.4 Regression] Mangling changes break ABI jakub at gcc dot gnu dot org
  2009-02-04 10:58 ` [Bug c++/39095] " jakub at gcc dot gnu dot org
@ 2009-02-04 13:03 ` pedro dot lamarao at mndfck dot org
  2009-02-04 13:40 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pedro dot lamarao at mndfck dot org @ 2009-02-04 13:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pedro dot lamarao at mndfck dot org  2009-02-04 13:02 -------
I can confirm this bug on my system.

[psilva@joana GCC]$ uname -a
Linux joana 2.6.27.12-170.2.5.fc10.i686 #1 SMP Wed Jan 21 02:09:37 EST 2009
i686 i686 i386 GNU/Linux

[psilva@joana GCC]$ g++ -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-cpu=generic --build=i386-redhat-linux
Thread model: posix
gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)

[psilva@joana GCC]$ g++-4.4 -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../trunk/configure --prefix=/opt/gcc-4.4 --enable-bootstrap
--enable-shared --enable-threads=posix --enable-checking=release
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-languages=c,c++ --with-cpu=generic --build=i386-redhat-linux
Thread model: posix
gcc version 4.4.0 20090204 (experimental) (GCC)

[psilva@joana GCC]$ cat test.cpp
struct B
{
  int b;
};

B b;

struct A
{
  B *operator->() const
  {
    return &b;
  }
  A () {}
};

A a;

int foo ()
{
  return a->b;
}

[psilva@joana GCC]$ g++ -c -o 43.o test.cpp

[psilva@joana GCC]$ g++-4.4 -c -o 44.o test.cpp

[psilva@joana GCC]$ nm 43.o
00000039 t _GLOBAL__I_b
00000000 T _Z3foov
00000016 t _Z41__static_initialization_and_destruction_0ii
00000000 W _ZN1AC1Ev
00000000 W _ZNK1AptEv
00000004 B a
00000000 B b

[psilva@joana GCC]$ nm 44.o
00000039 t _GLOBAL__I_b
00000000 T _Z3foov
00000016 t _Z41__static_initialization_and_destruction_0ii
00000000 W _ZN1AC1Ev
00000000 W _ZNK1AdtEv
         U __gxx_personality_v0
00000004 B a
00000000 B b


-- 

pedro dot lamarao at mndfck dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pedro dot lamarao at mndfck
                   |                            |dot org


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


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

* [Bug c++/39095] [4.4 Regression] Mangling changes break ABI
  2009-02-04 10:58 [Bug c++/39095] New: [4.4 Regression] Mangling changes break ABI jakub at gcc dot gnu dot org
  2009-02-04 10:58 ` [Bug c++/39095] " jakub at gcc dot gnu dot org
  2009-02-04 13:03 ` pedro dot lamarao at mndfck dot org
@ 2009-02-04 13:40 ` jakub at gcc dot gnu dot org
  2009-02-04 13:55 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-04 13:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2009-02-04 13:39 -------
Just doing:
@@ -1111,12 +1111,18 @@ write_unqualified_name (const tree decl)
   else if (DECL_OVERLOADED_OPERATOR_P (decl))
     {
       operator_name_info_t *oni;
+      enum tree_code code = DECL_OVERLOADED_OPERATOR_P (decl);
+
       if (DECL_ASSIGNMENT_OPERATOR_P (decl))
         oni = assignment_operator_name_info;
       else
-        oni = operator_name_info;
+        {
+          oni = operator_name_info;
+          if (code == COMPONENT_REF)
+            code = ARROW_EXPR;
+        }

-      write_string (oni[DECL_OVERLOADED_OPERATOR_P (decl)].mangled_name);
+      write_string (oni[(int) code].mangled_name);
     }
   else if (VAR_OR_FUNCTION_DECL_P (decl) && ! TREE_PUBLIC (decl)
            && DECL_NAMESPACE_SCOPE_P (decl)
is sufficient for the mangling, but still operator. appears in dumps etc.
instead of operator->, and I guess the name -> mangled name stuff in
write_expression won't do the right thing either.  So, either the operators.def
change should be reverted and dt should use a different code from COMPONENT_REF
(or no code at all and just write_string ("dt").  Or operator-> should be
parsed and handled as operator with ARROW_EXPR code rather than COMPONENT_REF.


-- 


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


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

* [Bug c++/39095] [4.4 Regression] Mangling changes break ABI
  2009-02-04 10:58 [Bug c++/39095] New: [4.4 Regression] Mangling changes break ABI jakub at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-02-04 13:40 ` jakub at gcc dot gnu dot org
@ 2009-02-04 13:55 ` jakub at gcc dot gnu dot org
  2009-02-04 15:57 ` jason at redhat dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-04 13:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2009-02-04 13:54 -------
Created an attachment (id=17242)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17242&action=view)
gcc44-pr39095.patch

Patch I'm going to bootstrap/regtest.  I think changing code for operator->
in all places is more risky than this.
Jason, does this look ok?


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED


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


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

* [Bug c++/39095] [4.4 Regression] Mangling changes break ABI
  2009-02-04 10:58 [Bug c++/39095] New: [4.4 Regression] Mangling changes break ABI jakub at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-02-04 13:55 ` jakub at gcc dot gnu dot org
@ 2009-02-04 15:57 ` jason at redhat dot com
  2009-02-04 16:50 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at redhat dot com @ 2009-02-04 15:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jason at redhat dot com  2009-02-04 15:57 -------
Subject: Re:  [4.4 Regression] Mangling changes break ABI

OK.

Jason


-- 


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


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

* [Bug c++/39095] [4.4 Regression] Mangling changes break ABI
  2009-02-04 10:58 [Bug c++/39095] New: [4.4 Regression] Mangling changes break ABI jakub at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-02-04 15:57 ` jason at redhat dot com
@ 2009-02-04 16:50 ` jakub at gcc dot gnu dot org
  2009-02-04 16:54 ` jakub at gcc dot gnu dot org
  2009-02-06 23:08 ` ian at airs dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-04 16:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2009-02-04 16:50 -------
Subject: Bug 39095

Author: jakub
Date: Wed Feb  4 16:50:22 2009
New Revision: 143933

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143933
Log:
        PR c++/39095
        * operators.def: Use COMPONENT_REF code for ->/pt operator again,
        remove ./dt operator.
        * mangle.c (write_expression): Handle COMPONENT_REF after handling
        ADDR_EXPR, for COMPONENT_REF without ARROW_EXPR inside of it
        write_string ("dt") instead of using operators.def.

        * g++.dg/abi/mangle31.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/abi/mangle31.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/mangle.c
    trunk/gcc/cp/operators.def
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/39095] [4.4 Regression] Mangling changes break ABI
  2009-02-04 10:58 [Bug c++/39095] New: [4.4 Regression] Mangling changes break ABI jakub at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-02-04 16:50 ` jakub at gcc dot gnu dot org
@ 2009-02-04 16:54 ` jakub at gcc dot gnu dot org
  2009-02-06 23:08 ` ian at airs dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-04 16:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2009-02-04 16:53 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/39095] [4.4 Regression] Mangling changes break ABI
  2009-02-04 10:58 [Bug c++/39095] New: [4.4 Regression] Mangling changes break ABI jakub at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-02-04 16:54 ` jakub at gcc dot gnu dot org
@ 2009-02-06 23:08 ` ian at airs dot com
  7 siblings, 0 replies; 9+ messages in thread
From: ian at airs dot com @ 2009-02-06 23:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from ian at airs dot com  2009-02-06 23:08 -------
*** Bug 39122 has been marked as a duplicate of this bug. ***


-- 

ian at airs dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian at airs dot com


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


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

end of thread, other threads:[~2009-02-06 23:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-04 10:58 [Bug c++/39095] New: [4.4 Regression] Mangling changes break ABI jakub at gcc dot gnu dot org
2009-02-04 10:58 ` [Bug c++/39095] " jakub at gcc dot gnu dot org
2009-02-04 13:03 ` pedro dot lamarao at mndfck dot org
2009-02-04 13:40 ` jakub at gcc dot gnu dot org
2009-02-04 13:55 ` jakub at gcc dot gnu dot org
2009-02-04 15:57 ` jason at redhat dot com
2009-02-04 16:50 ` jakub at gcc dot gnu dot org
2009-02-04 16:54 ` jakub at gcc dot gnu dot org
2009-02-06 23:08 ` ian at airs dot com

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