internal compiler error when code built with -mgeneral-regs-only calls inline function with inline assembly VFP instruction

Asked by Jacek Wywrót on 2020-10-15

arm-none-eabi-gcc.exe (GNU Arm Embedded Toolchain 9-2020-q2-update) 9.3.1 20200408 (release)
MCU: CYT2B9x cortex M4F
Compiler flags:
-std=gnu99 -c -pipe -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g -O2 -Wall -Wundef -fno-common -fno-strict-aliasing -ffunction-sections -fdata-sections -fshort-enums -Wno-comment -MMD -MP -mgeneral-regs-only -Wextra -Wno-missing-field-initializers -Wcast-align -Wcast-qual -Wredundant-decls -Wunused -Wunused-parameter -Wunused-variable -Wunused-label -Wunused-function -Wshadow -Wfloat-equal -Wimplicit -Wmissing-declarations -Wparentheses -Wpointer-arith -Wreturn-type -Wsequence-point -Wsign-compare -Wuninitialized -Winit-self -Wtrigraphs -Wswitch -Wbad-function-cast -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -MF

Generally the code is built with -mfloat-abi=hard -mfpu=fpv4-sp-d16, but only some translation units are built with -mgeneral-regs-only filtered out to allow using floating point.

__STATIC_FORCEINLINE uint32_t __get_FPSCR(void)
{
  uint32_t result;
  __ASM volatile ("VMRS %0, fpscr" : "=r" (result) );
  return(result);
}

Code calling the function built with -mgeneral-regs-only (see flags above):

...
__get_FPSCR()
...

Error:
a/b/c/d/e/f/g.c:316:1: error: unrecognizable insn:
  316 | }
      | ^
(insn 65 64 66 5 (set (reg:SI 157)
        (unspec_volatile:SI [
                (const_int 0 [0])
            ] VUNSPEC_GET_FPSCR)) "a/b/c/h/cmsis/include/cmsis_gcc.h":775:10 -1
     (nil))
during RTL pass: vregs
a/b/c/d/e/f/g.c:316:1: internal compiler error: in extract_insn, at recog.c:2310
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
...

Potential bug. Does anyone disagree?

Question information

Language:
English Edit question
Status:
Open
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
2020-10-15
Last reply:

Can you help with this problem?

Provide an answer of your own, or ask Jacek Wywrót for more information if necessary.

To post a message you must log in.