[LLVMbugs] [Bug 13513] New: C++ arguments passed by invisible reference have wrong type

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 2 07:33:32 PDT 2012


             Bug #: 13513
           Summary: C++ arguments passed by invisible reference have wrong
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: kv.bhat at samsung.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

When we compile the below code using clang -

class Obj
  Obj ();
  Obj (const Obj &);
  ~Obj ();
  int var;

int foo (Obj arg)
  return arg.var;

int main()
  Obj obj;

  return 0;    /* initialized */

Obj::Obj ()
  var = 1;

Obj::~Obj ()

and try to find type of foo in gdb-

(gdb) ptype foo
  type = int (Obj &)

Ideally  type = int (Obj) should have been generated as we are passing by

Similar issue is logged in GCC at 

When we debug we found that in 

void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,llvm::Value
*Storage,unsigned ArgNo, CGBuilderTy &Builder) function-

if (!Record->hasTrivialCopyConstructor() || !Record->hasTrivialDestructor())

we are creating a DIE with Reference type resulting in the above issue.

If we comment this part Test case and LLVM regression PASS.

Needed input from community why specifically DW_TAG_Reference is being created
here in case we have a user defined destructor or user defined copy constructor
and if this fix can be pushed to trunk.

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.

More information about the llvm-bugs mailing list