This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

(fyi) gcc 3.3.1, small change in 'operator int' method name


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;
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]