public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* (fyi) gcc 3.3.1, small change in 'operator int' method name
@ 2003-07-09 15:16 Michael Elizabeth Chastain
  0 siblings, 0 replies; only message in thread
From: Michael Elizabeth Chastain @ 2003-07-09 15:16 UTC (permalink / raw)
  To: gdb

I was looking at the differences between gcc 3.3 and gcc-3_3-branch
(soon to be gcc 3.3.1) and I found a small difference in conversion
operator encoding with -gstabs+.  I think gdb already handles this
correctly but I just wanted to mention it.

Attached is a small example program with two conversion operators.
With gcc 3.3 -gstabs+ the conversion operators are encoded like this:

  operator i::(1,10)=#(1,1),(0,1),(1,4),(1,7);:_ZN3FoocviEv;
  operator d::(1,11)=#(1,1),(0,13),(1,4),(1,7);:_ZN3FoocvdEv;

With gcc gcc-3_3-branch%20030707 -gstabs+ (and also gcc HEAD%20030707)
the conversion operators are encoded like this:

  operator 1::(1,10)=#(1,1),(0,1),(1,4),(1,7);:_ZN3FoocviEv;
  operator 2::(1,11)=#(1,1),(0,13),(1,4),(1,7);:_ZN3FoocvdEv;

gdb 5.3 has a little glitch when it handles the new 'operator 1' method
name.  is_type_conversion_operator does not recognize them as operator
names, so gdb prints their names as 'int operator int()', which is
wrong.

gdb gdb_6_0-branch and gdb HEAD have new code in the stabs reader,
update_method_name_from_physname.  This code discards the method name
'operator 1' and replaces it with a a demangled version of
'ZN3FoocviEv'.  So these versions of gdb don't even notice the change
from 'operator i' to 'operator 1'.  The updated method name is always
'operator int' and is_type_conversion_operator always works correctly.

dbxout.c in gcc has not changed in the gcc 3.3 branch since the gcc 3.3
release.  So this feels like an unintended change in gcc.

I just wanted to let y'all know about the method name change, just in
case it's ever important later.  Also I wanted to check that I
understand update_method_name_from_physname properly.

Michael C

===

  class Foo
  {
    public:
      Foo (int);
      operator int ();
      operator double ();
    private:
      int member_;
  };

  Foo::Foo (int member)
    : member_ (member)
  {
    ;
  }

  Foo::operator int()
  {
    return member_;
  }

  Foo::operator double()
  {
    return 1.0 * member_;
  }

  int main ()
  {
    Foo my_foo (117);
    return 0;
  }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-07-09 15:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-09 15:16 (fyi) gcc 3.3.1, small change in 'operator int' method name Michael Elizabeth Chastain

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