LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 52405 - Integrated assembler allows trailing instruction prefixes
Summary: Integrated assembler allows trailing instruction prefixes
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: -New Bugs (show other bugs)
Version: unspecified
Hardware: PC All
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-04 08:28 PDT by Smitty van Bodegom
Modified: 2021-11-04 08:28 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Smitty van Bodegom 2021-11-04 08:28:54 PDT
The LLVM integrated assembler incorrectly allows x86 instruction prefixes (like LOCK) without an actual instruction being prefixed. This should be rejected since LOCK isn't valid by itself: it's an instruction prefix that needs to be followed by an actual instruction. For example:

    int main() {
        __asm__("lock");
    }

The result is "Illegal instruction (core dumped)", since LOCK by itself isn't an instruction. This issue also occurs with (unstable) inline assembly in Rust (https://github.com/rust-lang/rust/issues/82314).