AM6548: TICLANG compiler warning -Warm-interrupt-vfp-clobber wrongly reported

Part Number: AM6548

Dear TI team,

I ask the same question again (previous thread is here: https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1645070/rm57l843-ticlang-compiler-warning--warm-interrupt-vfp-clobber-wrongly-reported/6358145) because apparently I was not in the right section. Note that this is not related to any microcontroller. This issue I am reporting concerns the TI CLANG compiler. But I couldn't find the "compiler" TI part number...

I would like to report a strange compiler behavior. I am using TI Arm Clang Compiler 5.1.0.LTS. The following warning is displayed despite the usage of the attribute `interrupt_save_fp`:

warning: interrupt service routine with vfp enabled may clobber the interruptee's vfp
      state; consider using the `interrupt_save_fp` attribute to prevent this behavior [-Warm-interrupt-vfp-clobber]

The warning is very easy to reproduce. Copy the following code in a .c file (e.g arm-interrupt-vfp-clobber.c):

int __attribute__( ( target( "arm" ), interrupt( "SWI" ) ) ) __attribute__( ( interrupt_save_fp ) ) handler( void )
{
    return 0;
}

Then run the following compile command:

tiarmclang -mthumb -mcpu=cortex-r5 -o arm-interrupt-vfp-clobber.o -c arm-interrupt-vfp-clobber.c

Could you tell me how to resolve this warning please (other than disabling it with -Wno-arm-interrupt-vfp-clobber)?

Best regards,

Vincent

  • Thank you for reporting this problem, and submitting a concise test case.  I am able to reproduce the same behavior.  I filed EXT_EP-13448 to have this investigated.  You are welcome to follow it with that link.  

    Could you tell me how to resolve this warning please (other than disabling it with -Wno-arm-interrupt-vfp-clobber)?

    Unfortunately, the only workaround is to use the option -Wno-arm-interrupt-vfp-clobber.

    Thanks and regards,

    -George

  • Hi Vincent,

    You should use the `interrupt_save_fp` attribute in place of the `interrupt` attribute and not at the same time.  The `interrupt_save_fp` attribute is meant to replace `interrupt` and works in exactly the same way except that it will also save the FP registers.

    Thanks!

    -Alan

  • Hi, thank you for your input. It is true that there is no warning when using only `interrupt_save_fp`.

    Unfortunately it doesn't seem true that  `interrupt_save_fp` "works in exactly the same way except that it will also save the FP registers" => the return is different, as you can see in the disassembly below:

    In my case I had to use the combination `interrupt_save_fp` + `interrupt("SWI")` to get the compiler generate the correct output.

    Important note: I just discovered that ticlang v4.0.4 LTS doesn't emit the false warning!

  • Write __attribute__((interrupt_save_fp("SWI"))) instead of __attribute__((interrupt("SWI")))

    Thanks and regards,

    -George