[llvm-bugs] [Bug 51308] New: invalid symbol redefinition when -O2 enabled
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Aug 2 10:54:17 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51308
Bug ID: 51308
Summary: invalid symbol redefinition when -O2 enabled
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C
Assignee: unassignedclangbugs at nondot.org
Reporter: zhan3299 at purdue.edu
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
Following code can be successfully compiled by O0 optimization on, but not O2.
Example code:
---
#include <stdio.h>
int func() {
int filter;
asm volatile(
" leaq _filter(%%rip), %%rax\n"
" jmp _out\n"
"_filter:\n"
".ascii \"\\040\"\n"
"_out:"
: "=rax"(filter)
:
:);
return filter;
}
int main() {
printf("%#x", func());
return 0;
}
---
Error message:
---
<source>:8:10: error: symbol '_filter' is already defined
"_filter:\n"
^
<inline asm>:3:1: note: instantiated into assembly here
_filter:
^
<source>:10:10: error: symbol '_out' is already defined
"_out:"
^
<inline asm>:5:1: note: instantiated into assembly here
_out:
^
2 errors generated.
ASM generation compiler returned: 1
<source>:8:10: error: symbol '_filter' is already defined
"_filter:\n"
^
<inline asm>:3:1: note: instantiated into assembly here
_filter:
^
<source>:10:10: error: symbol '_out' is already defined
"_out:"
^
<inline asm>:5:1: note: instantiated into assembly here
_out:
^
2 errors generated.
Execution build compiler returned: 1
---
It affects 11.0, 12.0, and trunk.
Trunk O0: https://godbolt.org/z/7afYjhGzc
Trunk O2: https://godbolt.org/z/6K71Tde6s
--
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/20210802/657ee5cc/attachment.html>
More information about the llvm-bugs
mailing list