public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110258] New: Undefined reference to intrinsic when taking function reference at namespace scope
@ 2023-06-14 19:08 magnus.hegdahl at gmail dot com
  2023-06-14 19:11 ` [Bug target/110258] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: magnus.hegdahl at gmail dot com @ 2023-06-14 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110258
           Summary: Undefined reference to intrinsic when taking function
                    reference at namespace scope
           Product: gcc
           Version: 13.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: magnus.hegdahl at gmail dot com
  Target Milestone: ---

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug target/110258] Undefined reference to intrinsic when taking function reference at namespace scope
  2023-06-14 19:08 [Bug c++/110258] New: Undefined reference to intrinsic when taking function reference at namespace scope magnus.hegdahl at gmail dot com
@ 2023-06-14 19:11 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-14 19:11 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is by design.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-14 19:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-14 19:08 [Bug c++/110258] New: Undefined reference to intrinsic when taking function reference at namespace scope magnus.hegdahl at gmail dot com
2023-06-14 19:11 ` [Bug target/110258] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).