Bug 110258 - Undefined reference to intrinsic when taking function reference at namespace scope
Summary: Undefined reference to intrinsic when taking function reference at namespace ...
Status: RESOLVED DUPLICATE of bug 100005
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 13.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-14 19:08 UTC by Magnus Hokland Hegdahl
Modified: 2023-06-14 19:11 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Hokland Hegdahl 2023-06-14 19:08:34 UTC
Tested on g++ (GCC) 13.1.1 20230429 on Linux

```
#include <x86intrin.h>

// this doesn't work in GCC (but does in clang)
constexpr auto set1 = _mm_set1_epi32;

// this works
struct S {
  static constexpr auto set1 = _mm_set1_epi32;
};

int main() {
  // and this works
  _mm_set1_epi32(1);
}
```

output:
/usr/bin/ld: /tmp/ccaN0gLC.o:(.data.rel.ro+0x0): undefined reference to `_mm_set1_epi32(int)'
collect2: error: ld returned 1 exit status

The code seems to work as expected with other function pointers,
even when defined in other translation units.
I've only seen the problem with intrinsics.
Comment 1 Andrew Pinski 2023-06-14 19:11:36 UTC
This is by design.

*** This bug has been marked as a duplicate of bug 100005 ***