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

            Bug ID: 102526
           Summary: Failed to link simd code if -O0
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cyb70289 at gmail dot com
  Target Milestone: ---

Below test code assigns an simd intrinsic to another variable, and call
intrinic through that variable. GCC failed to link if build with -O0.


Test code
=========
#include <emmintrin.h>
int main()
{
    auto func = _mm_add_epi8;
    auto v = func(_mm_set1_epi8(0), _mm_set1_epi8(1));
    return 0;
}


Build error
===========
$ g++ -O0 test.cc -msse2
/usr/bin/ld: /tmp/cc6pJnIg.o: in function `main':
test.cc:(.text+0x18): undefined reference to `_mm_add_epi8(long long
__vector(2), long long __vector(2))'
collect2: error: ld returned 1 exit status

$ g++ -O1 test.cc -msse2
<OK>

Reply via email to