https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116540
Bug ID: 116540
Summary: sh ignores asm operand modifier %c
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: vegard.nossum at oracle dot com
Target Milestone: ---
According to https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html, %c is a
generic (architecture-independent) operand modifier that is supposed to "print
the constant expression with no punctuation". However, on the sh architecture
the number is still prefixed by "#". Input:
void foo() {
asm volatile (".ascii \"%c0\"" :: "i" (123));
}
Result:
.ascii "#123"
See also: https://godbolt.org/z/8ePq1T4rY
This works correctly on other architectures like x86 and aarch64.