Re: Recursive calloc() due to optimization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 25 Mar 2015, Sebastian Huber wrote:

Hello,

I updated to GCC 5 and now it turns the RTEMS calloc() implementation into

Disassembly of section .text:

00000000 <calloc>:
  0:   fb01 f000       mul.w   r0, r1, r0
  4:   2101            movs    r1, #1
  6:   f7ff bffe       b.w     0 <calloc>
  a:   bf00            nop

on ARM. How can I disable this optimization? I tried

__attribute__((__optimize__("-fno-builtin")))
void *calloc(
 size_t nelem,
 size_t elsize
)
{
 char   *cptr;
 size_t  length;

 length = nelem * elsize;
 cptr = malloc( length );
 if ( cptr )
   memset( cptr, '\0', length );

 return cptr;
}

but this doesn't work. It this one of the -fno-tree-* options?

-fno-builtin is good, but you cannot use it in an optimize attribute.

--
Marc Glisse




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux