[llvm-bugs] [Bug 50449] New: allow indicating that calls to asm expressions are [[noreturn]]
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun May 23 02:48:27 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50449
Bug ID: 50449
Summary: allow indicating that calls to asm expressions are
[[noreturn]]
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: gonzalo.gadeschi 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
Example (minimized): https://gcc.godbolt.org/z/nqKq49q7a
[[noreturn]] void trap() {
asm volatile ("ret");
}
generates this LLVM-IR:
define dso_local void @_Z4trapv() #0 {
call void asm sideeffect "ret", "~{dirflag},~{fpsr},~{flags}"() #1,
!srcloc !4
ret void
}
attributes #0 = { noinline noreturn nounwind optnone uwtable mustprogress }
attributes #1 = { nounwind }
and there does not appear to be a way to add the LLVM-IR "noreturn" attribute
to the call such that #1 becomes:
attributes #1 = { nounwind noreturn }
There are a couple of ways in which this could be allowed, e.g.,:
- supporting: [[noreturn]] asm volatile(....)
- supporting: asm volatile(... : : : "noreturn")
If this is supported, both the LLVM-IR "call" or "invoke" instructions
generated should have the "noreturn" attribute.
Also, the warning produced:
warning: function declared 'noreturn' should not return
[-Winvalid-noreturn]
should probably be updated to take inline asm expressions that never return
into account.
--
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/20210523/dd3a07a4/attachment.html>
More information about the llvm-bugs
mailing list