public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108019] New: [ARM] D16 float register was used but not saved in integer-dominated code
@ 2022-12-08  7:33 zhangyuan21 at xiaomi dot com
  2022-12-08  7:34 ` [Bug c/108019] " zhangyuan21 at xiaomi dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zhangyuan21 at xiaomi dot com @ 2022-12-08  7:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

            Bug ID: 108019
           Summary: [ARM] D16 float register was used but not saved in
                    integer-dominated code
           Product: gcc
           Version: 11.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhangyuan21 at xiaomi dot com
  Target Milestone: ---

Created attachment 54044
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54044&action=edit
gcc version information

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/108019] [ARM] D16 float register was used but not saved in integer-dominated code
  2022-12-08  7:33 [Bug c/108019] New: [ARM] D16 float register was used but not saved in integer-dominated code zhangyuan21 at xiaomi dot com
@ 2022-12-08  7:34 ` zhangyuan21 at xiaomi dot com
  2022-12-08  7:52 ` zhangyuan21 at xiaomi dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zhangyuan21 at xiaomi dot com @ 2022-12-08  7:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

--- Comment #1 from zyfeier <zhangyuan21 at xiaomi dot com> ---
Created attachment 54045
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54045&action=edit
preprocessed file

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/108019] [ARM] D16 float register was used but not saved in integer-dominated code
  2022-12-08  7:33 [Bug c/108019] New: [ARM] D16 float register was used but not saved in integer-dominated code zhangyuan21 at xiaomi dot com
  2022-12-08  7:34 ` [Bug c/108019] " zhangyuan21 at xiaomi dot com
@ 2022-12-08  7:52 ` zhangyuan21 at xiaomi dot com
  2022-12-08  7:56 ` zhangyuan21 at xiaomi dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zhangyuan21 at xiaomi dot com @ 2022-12-08  7:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

--- Comment #2 from zyfeier <zhangyuan21 at xiaomi dot com> ---
C code:

int weak_function up_alarm_tick_start(clock_t ticks)
{
  int ret = -EAGAIN;

  if (g_oneshot_lower != NULL)
    {
      clock_t now = 0;
      clock_t delta;

      ONESHOT_TICK_CURRENT(g_oneshot_lower, &now);
      delta = ticks - now;
      if ((sclock_t)delta < 0)
        {
          delta = 0;
        }

      ret = ONESHOT_TICK_START(g_oneshot_lower, oneshot_callback,
                               NULL, delta);
    }

  return ret;
}

Part of assembly code:
38020444 <nxsched_resume_timer>:
380204b8:       e5920000        ldr     r0, [r2]
380204bc:       e5932000        ldr     r2, [r3]
380204c0:       e1540000        cmp     r4, r0
380204c4:       e5931004        ldr     r1, [r3, #4]
380204c8:       21a04000        movcs   r4, r0
380204cc:       e0940002        adds    r0, r4, r2
380204d0:       e2a11000        adc     r1, r1, #0
380204d4:       eb0038da        bl      3802e844 <up_alarm_tick_start>

3802e844 <up_alarm_tick_start>:
3802e844:       e92d49f0        push    {r4, r5, r6, r7, r8, fp, lr}
3802e848:       e30e66f8        movw    r6, #59128      ; 0xe6f8
3802e84c:       e343689c        movt    r6, #14492      ; 0x389c
3802e850:       e28db018        add     fp, sp, #24
3802e854:       e24dd024        sub     sp, sp, #36     ; 0x24
3802e858:       e5965000        ldr     r5, [r6]
3802e85c:       e59f31c0        ldr     r3, [pc, #448]  ; 3802ea24
<up_alarm_tick_start+0x1e0>
3802e860:       e3550000        cmp     r5, #0
3802e864:       e5933000        ldr     r3, [r3]
3802e868:       e50b3020        str     r3, [fp, #-32]  ; 0xffffffe0
3802e86c:       e3a03000        mov     r3, #0
3802e870:       0a00005e        beq     3802e9f0 <up_alarm_tick_start+0x1ac>
3802e874:       f2c00010        vmov.i32        d16, #0 ; 0x00000000
3802e878:       e1a07000        mov     r7, r0
3802e87c:       e1a00005        mov     r0, r5
3802e880:       e1a04001        mov     r4, r1
3802e884:       ed4b0b0d        vstr    d16, [fp, #-52] ; 0xffffffcc
3802e888:       eb004c98        bl      38041af0 <__asan_load4_noabort>
3802e88c:       e5958000        ldr     r8, [r5]
3802e890:       e288001c        add     r0, r8, #28
3802e894:       eb004c95        bl      38041af0 <__asan_load4_noabort>
3802e898:       e598301c        ldr     r3, [r8, #28]
3802e89c:       e3530000        cmp     r3, #0
3802e8a0:       0a000021        beq     3802e92c <up_alarm_tick_start+0xe8>
3802e8a4:       e24b1034        sub     r1, fp, #52     ; 0x34
3802e8a8:       e1a00005        mov     r0, r5
3802e8ac:       e12fff33        blx     r3

Problem:
At 0x3802e874 d16 was cleared, but the calling function does not save this
register.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/108019] [ARM] D16 float register was used but not saved in integer-dominated code
  2022-12-08  7:33 [Bug c/108019] New: [ARM] D16 float register was used but not saved in integer-dominated code zhangyuan21 at xiaomi dot com
  2022-12-08  7:34 ` [Bug c/108019] " zhangyuan21 at xiaomi dot com
  2022-12-08  7:52 ` zhangyuan21 at xiaomi dot com
@ 2022-12-08  7:56 ` zhangyuan21 at xiaomi dot com
  2022-12-08  8:50 ` zhangyuan21 at xiaomi dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zhangyuan21 at xiaomi dot com @ 2022-12-08  7:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

--- Comment #3 from zyfeier <zhangyuan21 at xiaomi dot com> ---
Created attachment 54046
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54046&action=edit
preprocessed file for calling function

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/108019] [ARM] D16 float register was used but not saved in integer-dominated code
  2022-12-08  7:33 [Bug c/108019] New: [ARM] D16 float register was used but not saved in integer-dominated code zhangyuan21 at xiaomi dot com
                   ` (2 preceding siblings ...)
  2022-12-08  7:56 ` zhangyuan21 at xiaomi dot com
@ 2022-12-08  8:50 ` zhangyuan21 at xiaomi dot com
  2022-12-08  8:53 ` zhangyuan21 at xiaomi dot com
  2022-12-08 10:44 ` rearnsha at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: zhangyuan21 at xiaomi dot com @ 2022-12-08  8:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

--- Comment #4 from zyfeier <zhangyuan21 at xiaomi dot com> ---
Compile Information:

CC:  timers/arch_alarm.c
arm-none-eabi-gcc -c -Wstrict-prototypes -nostdlib -pipe "-O3"
-fno-strict-aliasing -fno-omit-frame-pointer -fno-optimize-sibling-calls
-fstack-protector-all -fsanitize=kernel-address -fno-common -Wall -Wshadow
-Wundef -ffunction-sections -fdata-sections -g -mcpu=cortex-a7 -mfloat-abi=hard
-mfpu=neon-vfpv4 -mlittle-endian    -I. -isystem
/home/code/k03_dev/nuttx/include -D__NuttX__ -D__KERNEL__ -Wno-cpp -I
/home/code/k03_dev/nuttx/drivers/bch -I /home/code/k03_dev/nuttx/drivers/crypto
-I /home/code/nuttx/drivers/motor -I /home/code/nuttx/drivers/i2c -I
/home/code/nuttx/drivers/input -I /home/code/nuttx/drivers/ioexpander -I
/home/code/nuttx/drivers/lcd -I /home/code/nuttx/drivers/loop -I
/home/code/nuttx/drivers/mmcsd -I /home/code/nuttx/drivers/rptun -I
/home/code/nuttx/openamp/open-amp/lib -I /home/code/nuttx/drivers/sensors -I
/home/code/nuttx/drivers/usbhost -I /home/code/nuttx/drivers/video  
timers/arch_alarm.c -o  arch_alarm.o

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/108019] [ARM] D16 float register was used but not saved in integer-dominated code
  2022-12-08  7:33 [Bug c/108019] New: [ARM] D16 float register was used but not saved in integer-dominated code zhangyuan21 at xiaomi dot com
                   ` (3 preceding siblings ...)
  2022-12-08  8:50 ` zhangyuan21 at xiaomi dot com
@ 2022-12-08  8:53 ` zhangyuan21 at xiaomi dot com
  2022-12-08 10:44 ` rearnsha at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: zhangyuan21 at xiaomi dot com @ 2022-12-08  8:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

--- Comment #5 from zyfeier <zhangyuan21 at xiaomi dot com> ---
Compile Information:

CC:  timers/arch_alarm.c
arm-none-eabi-gcc -c -Wstrict-prototypes -nostdlib -pipe "-O3"
-fno-strict-aliasing -fno-omit-frame-pointer -fno-optimize-sibling-calls
-fstack-protector-all -fsanitize=kernel-address -fno-common -Wall -Wshadow
-Wundef -ffunction-sections -fdata-sections -g -mcpu=cortex-a7 -mfloat-abi=hard
-mfpu=neon-vfpv4 -mlittle-endian    -I. -isystem /home/code/nuttx/include
-D__NuttX__ -D__KERNEL__ -Wno-cpp -I /home/code/nuttx/drivers/bch -I
/home/code/nuttx/drivers/crypto -I /home/code/nuttx/drivers/motor -I
/home/code/nuttx/drivers/i2c -I /home/code/nuttx/drivers/input -I
/home/code/nuttx/drivers/ioexpander -I /home/code/nuttx/drivers/lcd -I
/home/code/nuttx/drivers/loop -I /home/code/nuttx/drivers/mmcsd -I
/home/code/nuttx/drivers/rptun -I /home/code/nuttx/openamp/open-amp/lib -I
/home/code/nuttx/drivers/sensors -I /home/code/nuttx/drivers/usbhost -I
/home/code/nuttx/drivers/video   timers/arch_alarm.c -o  arch_alarm.o

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c/108019] [ARM] D16 float register was used but not saved in integer-dominated code
  2022-12-08  7:33 [Bug c/108019] New: [ARM] D16 float register was used but not saved in integer-dominated code zhangyuan21 at xiaomi dot com
                   ` (4 preceding siblings ...)
  2022-12-08  8:53 ` zhangyuan21 at xiaomi dot com
@ 2022-12-08 10:44 ` rearnsha at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2022-12-08 10:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108019

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #6 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
d16 is a call-clobbered register in the ABI. There is no need for the compiler
to save it before use.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-08 10:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08  7:33 [Bug c/108019] New: [ARM] D16 float register was used but not saved in integer-dominated code zhangyuan21 at xiaomi dot com
2022-12-08  7:34 ` [Bug c/108019] " zhangyuan21 at xiaomi dot com
2022-12-08  7:52 ` zhangyuan21 at xiaomi dot com
2022-12-08  7:56 ` zhangyuan21 at xiaomi dot com
2022-12-08  8:50 ` zhangyuan21 at xiaomi dot com
2022-12-08  8:53 ` zhangyuan21 at xiaomi dot com
2022-12-08 10:44 ` rearnsha at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).