[Bug target/95740] New: Failure to avoid using the stack when interpreting a float as an integer when it is modified afterwards

gabravier at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jun 18 11:06:11 GMT 2020


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

            Bug ID: 95740
           Summary: Failure to avoid using the stack when interpreting a
                    float as an integer when it is modified afterwards
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

int32_t f(float p)
{
    int32_t tmp;
    memcpy(&tmp, &p, sizeof(float));
    ++tmp;
    return tmp;
}

With -O3, LLVM outputs this :

f(float):
  movd eax, xmm0
  add eax, 1
  ret

GCC outputs this :

f(float):
  movd DWORD PTR [rsp-4], xmm0
  mov eax, 1
  add eax, DWORD PTR [rsp-4]
  ret


More information about the Gcc-bugs mailing list