[all-commits] [llvm/llvm-project] f76d3b: [clang][CGStmt] fix crash on invalid asm statement
Tong Zhang via All-commits
all-commits at lists.llvm.org
Wed Mar 2 11:19:09 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f76d3b800f7341882ea93db47cc8f28d94e74f1c
https://github.com/llvm/llvm-project/commit/f76d3b800f7341882ea93db47cc8f28d94e74f1c
Author: Tong Zhang <ztong0001 at gmail.com>
Date: 2022-03-02 (Wed, 02 Mar 2022)
Changed paths:
M clang/lib/CodeGen/CGStmt.cpp
M clang/test/CodeGen/X86/x86_64-PR42672.c
Log Message:
-----------
[clang][CGStmt] fix crash on invalid asm statement
Clang is crashing on the following statement
char var[9];
__asm__ ("" : "=r" (var) : "0" (var));
This is similar to existing test: crbug_999160_regtest
The issue happens when EmitAsmStmt is trying to convert input to match
output type length. However, that is not guaranteed to be successful all the
time and if the statement itself is invalid like having an array type in
the example, we should give a regular error message here instead of
using assert().
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D120596
More information about the All-commits
mailing list