https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94986
Bug ID: 94986 Summary: missing diagnostic on ARM thumb2 compilation with -pg when using r7 in inline asm Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: arnd at linaro dot org Target Milestone: --- I reported a bug against clang for a Linux kernel failure, but it was suggested that the clang behavior is probably correct in this corner case while gcc gets it wrong, see https://bugs.llvm.org/show_bug.cgi?id=45826 echo 'void f(void) { asm("mov r7, #0" ::: "r7"); }' | arm-linux-gnueabi-gcc -march=armv7-a -O2 -mthumb -pg -S -xc - silently accepts an inline asm statement that clobbers the frame pointer, but gcc rejects the same code if any of '-O0', '-fomit-frame-pointer' or 'fno-omit-frame-pointer' are used: <stdin>: In function 'f': <stdin>:1:44: error: r7 cannot be used in 'asm' here If using r7 in this case is indeed invalid, we need to ensure the kernel does not do this, and having gcc reject it would be helpful.