public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrey Slepuhin <pooh@msu.ru>
To: gcc@gcc.gnu.org
Subject: [gcc-3.0 bug?] C++ symbols treated as C
Date: Sun, 22 Apr 2001 22:34:00 -0000	[thread overview]
Message-ID: <20010423093415.H4326@glade.nmd.msu.ru> (raw)

Hi,

Trying to upgrade from 20010311 to 20010419 gcc snapshot
(taken from CodeSourcery) I got undefined references
when linking my C++ code. Looking into assembler output I see the
things like following:

        movl    _ZN5grace16shared_allocatorE, %eax
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        movl    (%eax), %ecx
        pushl   $16
        pushl   %eax
.LCFI4:
        call    *8(%ecx)
        movl    %eax, %ebx
        addl    $16, %esp
        testl   %ebx, %ebx
        jne     .L3
        subl    $12, %esp
        pushl   $132
        pushl   $.LC0
        pushl   $_ZZN5grace5T_ValIiEnwEjE19__PRETTY_FUNCTION__
        pushl   $.LC1
        pushl   stderr
.LCFI5:
        call    fprintf
        addl    $20, %esp
        pushl   $.LC2
.LCFI6:
        call    _ZN3pxx5fatalEPcz
        addl    $16, %esp
.L3:
.LBE4:
.LBE3:
.LEHB5:
        subl    $10, %esp
        pushw   $0
        pushl   %ebx
        call    _ZN5grace5T_ValIiEC1Eb
.LEHE5:
        addl    $16, %esp
        .stabs  "test.cc",132,0,0,.Ltext2
.Ltext2:
        .stabn 68,0,13,.LM3-_Z5tmainiPPc
.LM3:
        xorl    %eax, %eax
        movl    -4(%ebp), %ebx
        leave
        ret
.LBE2:
        .p2align 2
.L5:
.LEHB13:
        movb    $1, %dl
        testb   %dl, %dl
        je      .L7
        .stabs  "../src/gr_tval.hh",132,0,0,.Ltext3
.Ltext3:
        .stabn 68,0,135,.LM4-_Z5tmainiPPc
.LM4:
        subl    $8, %esp
        movl    shared_allocator, %eax
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        movl    (%eax), %ecx
        pushl   %ebx
        pushl   %eax
        call    *12(%ecx)
        addl    $16, %esp
.L7:
        subl    $12, %esp
        pushl   $.LRTH5
        call    __rethrow
        .p2align 2
.L13:
.LEHE13:
.LCFI7:
        call    _ZSt9terminatev



Note that in lower part of code symbol `shared_allocator' looks like
C symbol. 20010311 snapshot produces correct mangled C++ name in that
place. What may be wrong in this situation?

Appropriate C++ code looks like this:

#include "gr_shared_allocator.hh"

template <typename val_t>
class T_Val
{

.....

void* operator new (size_t _size) \
{
  void* p = shared_allocator->allocate(_size);
  if (p == null) FATAL("Memory allocation failed");
  return p;
}

......
};

int tmain (int argc, char* argv[])
{
  T_Val<int>* p = new T_Val<int>;
  return 0;
}

where template class T_Val has overloaded new() operator:

Yes, I'm 100% sure that all declarations are done in proper places.
If needed, I can send actual .ii output but it is rather large.

Regards,
Andrey.

-- 
A right thing should be simple (tm)

             reply	other threads:[~2001-04-22 22:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-22 22:34 Andrey Slepuhin [this message]
2001-04-24  3:29 ` Andrey Slepuhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010423093415.H4326@glade.nmd.msu.ru \
    --to=pooh@msu.ru \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).