[LLVMbugs] [Bug 14318] New: Objective-C properties of types with no trivial special members leads to assert

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Nov 11 16:43:49 PST 2012


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

             Bug #: 14318
           Summary: Objective-C properties of types with no trivial
                    special members leads to assert
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Modified from test/CodeGenObjCXX/property-objects.mm:

class S {
public:
        S& operator = (const S&);
        S& operator = (S&&);
        S (const S&);
        S (S&&);
        S ();
};

@interface I {
  S position;
}
@property(assign, nonatomic) S position;
@end

void f(I *i) {
  S s;
  i.position = s;
}

clang-3.2: lib/CodeGen/CGExprAgg.cpp:1289: void
clang::CodeGen::CodeGenFunction::EmitAggregateCopy(llvm::Value *, llvm::Value
*, clang::QualType, bool, clang::CharUnits, bool): Assertion
`(Record->hasTrivialCopyConstructor() || Record->hasTrivialCopyAssignment() ||
Record->hasTrivialMoveConstructor() || Record->hasTrivialMoveAssignment()) &&
"Trying to aggregate-copy a type without a trivial copy " "constructor or
assignment operator"' failed.

It appears that the @property mechanism is completely broken for properties of
non-trivially-copyable class type -- it always uses a memcpy -- but this assert
usually doesn't manage to catch it. For instance, we currently generate wrong
code for CodeGenObjCXX/property-objects.mm; look at 'main', note that the
instance of 'class S' passed to objc_msgSend has not had a constructor called
for it (or add a data member to 'S' and note that we emit a memcpy rather than
a copy constructor call).

Fixing release-blocker PR14279 causes three unit tests to fail this way
(because we consider fewer classes to have trivial move operations), and it
seems pretty important, so I'm marking it release-blocker too.

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