[Bug target/86673] [8/9 regression] inline asm sometimes ignores 'register asm("reg")' declarations
arnd at linaro dot org
gcc-bugzilla@gcc.gnu.org
Wed Jul 25 15:43:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86673
--- Comment #11 from Arnd Bergmann <arnd at linaro dot org> ---
I have checked all instances of 'register const' or 'const register' in the
current linux kernel (4.18-rc), and we never assign a constant expression to
any of them, so I guess none of them are affected:
arch/arm/include/asm/uaccess.h: register const void __user *__p
asm("r0") = __ptr; \
arch/h8300/kernel/sim-console.c: register const char *_ptr
__asm__("er1") = s;
arch/h8300/kernel/sim-console.c: register const unsigned _len
__asm__("er2") = n;
arch/mips/include/asm/uaccess.h: register const void __user *__cu_from_r
__asm__("$5"); \
arch/mips/include/asm/uaccess.h: register const void *__cu_from_r
__asm__("$5"); \
arch/riscv/kernel/process.c: const register unsigned long gp __asm__
("gp");
arch/riscv/kernel/stacktrace.c: const register unsigned long current_sp
__asm__ ("sp");
arch/riscv/kernel/stacktrace.c: const register unsigned long current_sp
__asm__ ("sp");
Should we drop the 'const' for all of them as a rule? If there is no use case
for ever using a 'const register' variable and it can lead to bugs, should gcc
warn about it in the future?
Should this issue be mentioned in the documentation in
https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html?
I also checked all instances in linux-4.4, and the ARM put_user() helper is the
only one I see that gets a constant expression input, so I suppose that is all
that needs to be fixed in backports, unless someone thinks we should get rid of
all them in backports as well.
More information about the Gcc-bugs
mailing list