GCC refusing to inline a trivial function inside a cilk spawned function

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

 



      Dear all,

I extremely happy to have the new GCC 4.9 support the CilkPlus extension. It
is both very powerful and extremely simple to use. However, I've hit what I
suspect is a bug, but before filing a bug report, I'd like to check that this
is not due to some internal I don't know about. Consider the following code

    __attribute__ ((always_inline)) inline int get() { return 1; }

    void Bar() {
      if (get() == 0) _Cilk_spawn Bar();
    }

    int main(int argc, char **argv) {
      Bar();
    }

It compile without any problem with the following fake Cilk command
   /opt/gcc-4.9.0/bin/g++ -D_Cilk_spawn='' inl.cpp
But when compiled with a genuine Cilk
   /opt/gcc-4.9.0/bin/g++ -fcilkplus inl.cpp
I got the following error message:

nl.cpp: In function ‘void Bar()’:
inl.cpp:4:44: error: inlining failed in call to always_inline ‘int get()’: function not inlinable
 __attribute__ ((always_inline)) inline int get() { return 1; }
                                            ^
inl.cpp:7:11: error: called from here
   if (get() == 0) _Cilk_spawn Bar();

So my question is: Is it a genuine bug and I should file a report, or is there
an internal of the Cilk spawned function which prevent inlining.

For the info, I found that problem noticing that indexed access to C++11
std::array (ie std::array::operator[](size_type)) wasn't inlined
causing a large performance degradation to my code.

Cheers,

Florent Hivert




[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