[PATCH] Fix for PR14269: Clang crashes when a bit field is used as inline assembler input / output with memory constraint

Andrey Bokhanko andreybokhanko at gmail.com
Tue Jun 9 08:39:41 PDT 2015


Richard, I will take a look.

Yours,
Andrey


On Tue, Jun 9, 2015 at 1:13 AM, Richard Smith <richard at metafoo.co.uk> wrote:
> 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