This testcase:
/* f.c */
extern double exp (double);
extern float strtof(const char*, char**);

inline float expf (float x)
  {return (float) exp (x);}

int main (int argc, char** argv)
{
  float f; 
  if (argc > 1)
  {
    f = strtof (argv[1],  (void*)0);
    printf ("%g\n", expf(f));
  }
  return 0;
}

compiled with gcc version 4.2.0 20060913

goes into infinite loop when expf is called

Here is assembly

        .file   "f.c"
        .text
        .p2align 4,,15
.globl _expf
        .def    _expf;  .scl    2;      .type   32;     .endef
_expf:
        pushl   %ebp
        movl    %esp, %ebp
        popl    %ebp
        jmp     _expf
<snip>

It works fine if compiled with -fno-builtin-exp

This is regression from 3.4.5. 

Danny


-- 
           Summary: Inline definition vs builtin function calls
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dannysmith at users dot sourceforge dot net
  GCC host triplet: i386-pc-mingw32
GCC target triplet: i386-pc-mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29094

Reply via email to