-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-inline-assemblyArea: Inline assembly (`asm!(…)`)Area: Inline assembly (`asm!(…)`)P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
On playpen nightly
#![crate_type="lib"]
#![feature(asm)]
fn main() {
unsafe {
routine()
}
}
pub unsafe fn routine() {
asm!("mov ecx, 0xFF
.loop:
loop .loop"
: // no outputs
: // no inputs
: "ecx"
: "intel");
}
pub unsafe fn routine2() {
routine(); // causes inlining, duplicating the symbol improperly
}
<anon>:11:5: 17:22 error: <inline asm>:3:11: error: invalid symbol redefinition
.loop:
^
<anon>:11 asm!("mov cx, 0xFF
<anon>:12 .loop:
<anon>:13 loop .loop"
<anon>:14 : // no outputs
<anon>:15 : // no inputs
<anon>:16 : "ecx"
...
error: aborting due to previous error
playpen: application terminated with error code 101
The following two conditions are necessary to trigger this:
- Generating a library (
#![crate_type="lib"]
) - At least
-C opt-level=2
Without both of these, the error does not occur.
Metadata
Metadata
Assignees
Labels
A-inline-assemblyArea: Inline assembly (`asm!(…)`)Area: Inline assembly (`asm!(…)`)P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.