[PATCH] D12955: Fix assertion in inline assembler IR gen

Alexander Musman via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 21 03:38:14 PDT 2015


amusman added inline comments.

================
Comment at: lib/Sema/SemaStmtAsm.cpp:447
@@ +446,3 @@
+    // Make sure no more than one input constraint matches each output.
+    if (InputMatchedToOutput[TiedTo] != ~0U) {
+      Diag(NS->getInputExpr(i)->getLocStart(),
----------------
aaron.ballman wrote:
> Is it possible for InputConstraintsInfos.size() to be greater than OutputConstrainInfos.size()? Basically, I'm worried about buffer overflow here with TiedTo.
The check above (which emits error err_asm_invalid_input_constraint) seems to capture this case so I always get correct TiedTo value here.
What if I add an assertion that TiedTo>=0 && TiedTo <InputMatchedToOutput.size()?


http://reviews.llvm.org/D12955





More information about the cfe-commits mailing list