http://llvm.org/bugs/show_bug.cgi?id=14354

             Bug #: 14354
           Summary: operator overloading fails while debugging with gdb
                    for i386.
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


Created attachment 9547
  --> http://llvm.org/bugs/attachment.cgi?id=9547
assembly file for the code

For the given test: 

class A1 {
  int x;
  int y;

  public:

  A1(int a, int b)
  {
   x=a;
   y=b;
  }

A1 operator+(const A1&);
};


A1 A1::operator+(const A1& second)
{
 A1 sum(0,0);
 sum.x = x + second.x;
 sum.y = y + second.y;

 return (sum);
}


int main (void)
{
 A1 one(2,3);
 A1 two(4,5);

 return 0;
}


when the exectable of this code is debugged in gdb for i386, we dont get the
expected results.

when we break at return 0; and give the command: print one + two, the result
should be $1 = {x = 6, y = 8}, but the result obtained is $1 = {x = 2, y = 3}.

This is related to debug information generated, as normally the overloading is
occuring.
eg: A1 three = one + two results {x = 6, y = 8}.


On checking the assembly, a suspicious entry is found which may be related for
the failure:

    #DEBUG_VALUE: operator+:this <- undef
    #DEBUG_VALUE: operator+:second <- undef

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to