[LLVMbugs] [Bug 21347] New: Assertion failed: (E && hasScalarEvaluationKind(E->getType()) && "Invalid scalar expression to emit")

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 22 14:31:53 PDT 2014


            Bug ID: 21347
           Summary: Assertion failed: (E &&
                    hasScalarEvaluationKind(E->getType()) && "Invalid
                    scalar expression to emit")
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: compnerd at compnerd.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Objective-C++ ARC CodeGen seems incorrect.

Consider the following input:

typedef __SIZE_TYPE__ size_t;

namespace std {
template <typename _Ep>
class initializer_list {
  const _Ep *__begin_;
  size_t __size_;
  initializer_list(const _Ep *__b, size_t __size);

@interface NSObject
+ (instancetype) new;

void function(std::initializer_list<NSObject *>);

void single() { function({ [NSObject new] }); }

void multiple() { function({ [NSObject new], [NSObject new] }); }

std::initializer_list<NSObject *> il = { [NSObject new] };

In all of these cases, the interesting bit is the intializer_list construction.
 The materialization will try to construct a NSObject * const __strong [1] or
NSObject * const __strong [2].  However, in CGExpr.cpp
CGF::EmitMaterializeTemporaryExpr, we explicitly call EmitScalarInit, thus
ending up trying to emit an aggregate as a scalar.  This triggers an assertion.

Handling that either by using EmitAggLValue or EmitAnyExprToMem (or better yet,
removing the special case), trigger a secondary assertion in
pushTemporaryCleanup which also seems bogus:

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141022/62be97ce/attachment.html>

More information about the llvm-bugs mailing list