[Bug c++/62282] New: Undefined reference with __inline __attribute(__gnu_inline__) with -O0

dmitry.petroff at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 27 11:38:00 GMT 2014


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

            Bug ID: 62282
           Summary: Undefined reference with __inline
                    __attribute(__gnu_inline__) with -O0
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dmitry.petroff at gmail dot com

The following code produces "undefined reference to `test(int)'" message when
compiled with g++ -O0 test.cpp:

// == cut ==
__inline
__attribute__ ((__gnu_inline__))
int test(int v)
{
    return v;
}

int main(int argc, char **argv)
{
    return test(argc);
}
// == cut ==

It links successfully in C mode.
This bug breaks for me usage of gperf's C output in C++ code with simple
"include" directive.



More information about the Gcc-bugs mailing list