pro64-support
[Top] [All Lists]

c++ fe bugs

To: pro64-support@xxxxxxxxxxx
Subject: c++ fe bugs
From: David Goodwin <goodwin@xxxxxxxxxxxxx>
Date: Wed, 7 Mar 2001 14:39:50 -0800 (PST)
Cc: goodwin@xxxxxxxxxxxxx
Reply-to: goodwin@xxxxxxxxxxxxx
Sender: owner-pro64-support@xxxxxxxxxxx
I've mostly completed work on adding exception handling to the compiler,
but I've run across several c++ fe bugs that are holding me up. Before
trying to tackle them myself, I wanted to see if you had already fixed
them...

The attached code and fe whirl show some of the problems.

1. There are object copies introduced without using the ECLASS copy
   constructor. Some of these are trivial to optimize: 

    MMLDID 0 <2,3,anon2> T<28,ECLASS,4>
   MSTID 0 <2,3,anon2> T<28,ECLASS,4>

   but others are introduced by the MCOMMA expressions:

   MMLDID 0 <2,2,anon1> T<28,ECLASS,4>
  MCOMMA
 MRETURN_VAL

2. The calling standard for passing/returning objects seems incorrect. I'm
   not good at reading ia64 code, but looking as the assembly file, it
   seems the ECLASS object is passed and returned by value (i.e. by copying
   into registers and or memory). g++ seems to pass a class by reference if
   it has no methods. Mips mongoose seems a little smarter in that it only
   passes a class by reference if it has a copy constructor.

David




class ECLASS
{
private:
  int _i[10];

public:
  static int _cnt;
  
  ECLASS ();
  ECLASS (int i);
  ECLASS (const ECLASS& ec);
  ~ECLASS();
  int val (void) const;
};

extern ECLASS foo (ECLASS);

ECLASS
eh1 (int sel)
{
  return foo(ECLASS(1));
}



 LOC 0 0 source files:  1       "/usr/local/home/goodwin/simp.ii"
 LOC 0 0 source files:  2       "/usr/local/home/goodwin/simp.cc"
 LOC 2 19 eh1 (int sel)
 LOC 2 20 {
FUNC_ENTRY <1,21,eh1__Fi>
 IDNAME 0 <2,1,sel>
BODY
 BLOCK
 END_BLOCK
 BLOCK
 END_BLOCK
 BLOCK
 PRAGMA 0 120 <null-st> 0 (0x0) # PREAMBLE_END
 LOC 2 21   return foo(ECLASS(1));
   BLOCK
     U8LDA 0 <2,3,anon2> T<33,anon_ptr.,8>
    U8PARM 2 T<33,anon_ptr.,8> #  by_value 
     I4INTCONST 1 (0x1)
    I4PARM 2 T<4,.predef_I4,4> #  by_value 
   VCALL 126 <1,26,__6ECLASSi> # flags 0x7e
    MMLDID 0 <2,3,anon2> T<28,ECLASS,4>
   MSTID 0 <2,3,anon2> T<28,ECLASS,4>
     BLOCK
       MMLDID 0 <2,3,anon2> T<28,ECLASS,4>
      MPARM 2 T<28,ECLASS,4> #  by_value 
     MCALL 126 <1,25,foo__FG6ECLASS> # flags 0x7e
      MMLDID -1 <1,19,.preg_return_val> T<28,ECLASS,4>
     MSTID 0 <2,4,.Mreturn.foo__FG6ECLASS_temp_0> T<28,ECLASS,4>
     END_BLOCK
     MMLDID 0 <2,4,.Mreturn.foo__FG6ECLASS_temp_0> T<28,ECLASS,4>
    MCOMMA
   MSTID 0 <2,2,anon1> T<28,ECLASS,4>
     U8LDA 0 <2,3,anon2> T<33,anon_ptr.,8>
    U8PARM 2 T<33,anon_ptr.,8> #  by_value 
     I4INTCONST 2 (0x2)
    I4PARM 2 T<4,.predef_I4,4> #  by_value 
   VCALL 126 <1,27,_._6ECLASS> # flags 0x7e
   END_BLOCK
   MMLDID 0 <2,2,anon1> T<28,ECLASS,4>
  MCOMMA
 MRETURN_VAL
 LOC 2 22 }
LABEL L1 0
 END_BLOCK

<Prev in Thread] Current Thread [Next in Thread>
  • c++ fe bugs, David Goodwin <=