[PATCH] Fix for PR14269: Clang crashes when a bit field is used as inline assembler input / output with memory constraint
Richard Smith
richard at metafoo.co.uk
Mon Jun 8 15:13:09 PDT 2015
REPOSITORY
rL LLVM
================
Comment at: cfe/trunk/lib/Sema/SemaStmtAsm.cpp:158
@@ +157,3 @@
+ // Bitfield can't be referenced with a pointer.
+ if (Info.allowsMemory() && OutputExpr->refersToBitField())
+ return StmtError(Diag(OutputExpr->getLocStart(),
----------------
What about other weird kinds of lvalues, like the result of `__real` / `__imag`, vector indexing, and global register variables? Those have the same problem; CGStmt.cpp blindly calls `LValue::getAddress` without checking for those cases.
Testcase:
typedef __attribute__((vector_size(16))) int vi4;
void test(vi4 v) {
__asm__("" : "=rm"(v[2]));
}
http://reviews.llvm.org/D10086
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list