diff options
author | AdUhTkJm <30948580+AdUhTkJm@users.noreply.github.com> | 2024-12-17 19:44:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-17 18:44:25 +0700 |
commit | 449af81f922cdb7a1f24b4c1e989f30848e1d762 (patch) | |
tree | 4d67377ccbf838e4364f0f8203847136c02d01b0 /clang/lib | |
parent | 24c2744a189eef9dfd39789df4983e4ffd219197 (diff) | |
download | llvm-449af81f922cdb7a1f24b4c1e989f30848e1d762.zip llvm-449af81f922cdb7a1f24b4c1e989f30848e1d762.tar.gz llvm-449af81f922cdb7a1f24b4c1e989f30848e1d762.tar.bz2 |
[Clang] Fix crash for incompatible types in inline assembly (#119098)
Fixed issue #118892.
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaStmtAsm.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp index 0b272b8..a0b203f 100644 --- a/clang/lib/Sema/SemaStmtAsm.cpp +++ b/clang/lib/Sema/SemaStmtAsm.cpp @@ -664,11 +664,16 @@ StmtResult Sema::ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, SmallerValueMentioned |= OutSize < InSize; } + // If the input is an integer register while the output is floating point, + // or vice-versa, there is no way they can work together. + bool FPTiedToInt = (InputDomain == AD_FP) ^ (OutputDomain == AD_FP); + // If the smaller value wasn't mentioned in the asm string, and if the // output was a register, just extend the shorter one to the size of the // larger one. - if (!SmallerValueMentioned && InputDomain != AD_Other && + if (!SmallerValueMentioned && !FPTiedToInt && InputDomain != AD_Other && OutputConstraintInfos[TiedTo].allowsRegister()) { + // FIXME: GCC supports the OutSize to be 128 at maximum. Currently codegen // crash when the size larger than the register size. So we limit it here. if (OutTy->isStructureType() && |