[llvm-bugs] [Bug 51081] New: clang crash with inline asm that has function type as input operand
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jul 13 10:58:03 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51081
Bug ID: 51081
Summary: clang crash with inline asm that has function type as
input operand
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C
Assignee: unassignedclangbugs at nondot.org
Reporter: jasonliu.development at gmail.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Reduced test case:
```
void callee(void);
void caller() {
asm volatile("rcall %0"::"n"(callee));
}
```
Without assertion, compiler crashes in llvm and getting stack dump:
https://godbolt.org/z/hb4acs8aG
With assertion turned on, compiler hit
`assert(!LV.getType()->isFunctionType());` in
`CodeGenFunction::EmitLoadOfLValue()` clang/lib/CodeGen/CGExpr.cpp.
So it seems we might already generated wrong IR from clang which leads to the
crash in LLVM (in non-assert mode).
The easy change would be to reverse part of this fix:
https://github.com/llvm/llvm-project/commit/d68b2d043865e1c106432f2ab9c1b99a5a2ba86e
i.e. to remove the assertion and bring back the if statement.
But it seems that we might prefer to have a sema component change (i.e. detect
if it's a function then do a function to pointer decay) instead of waiting to
change it in the last minute of clang code gen.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210713/0a49f51f/attachment.html>
More information about the llvm-bugs
mailing list