public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106825] New: header unit <memory> based std::shared_ptr<...>(...) use gets: undefined reference to `std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()', aarch64 example
@ 2022-09-04  7:20 markmigm at gmail dot com
  2022-09-04 16:38 ` [Bug c++/106825] " markmigm at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: markmigm at gmail dot com @ 2022-09-04  7:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106825
           Summary: header unit <memory> based std::shared_ptr<...>(...)
                    use gets: undefined reference to
                    `std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M
                    _release()', aarch64 example
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: markmigm at gmail dot com
  Target Milestone: ---

In, for example, aarch64 Fedora 36, with its g++ 12.2.1 related
toolchain, the program:

// c++ -std=c++20 -pedantic -Wall -Wextra -fmodules-ts -fPIC
-xc++-system-header memory
// c++ -std=c++20 -pedantic -Wall -Wextra -fmodules-ts -fPIC
-omodule_shared_ptr_failure module_shared_ptr_failure.cpp

import <memory>;

struct base{int v=0;};

int main()
{
        return std::shared_ptr<base>(new base{})->v;
}

gets the following failure for the shown command sequence:

# c++ -std=c++20 -pedantic -Wall -Wextra -fmodules-ts -fPIC -xc++-system-header
memory

# c++ -std=c++20 -pedantic -Wall -Wextra -fmodules-ts -fPIC
-omodule_shared_ptr_failure module_shared_ptr_failure.cpp
/usr/bin/ld: /tmp/ccm2DaSN.o: in function
`std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count()':
module_shared_ptr_failure.cpp:(.text._ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EED2Ev[_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EED5Ev]+0x24):
undefined reference to
`std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()'
collect2: error: ld returned 1 exit status

The -fPIC use is not required to see the problem.

For reference:

# c++ -v
Using built-in specs.
COLLECT_GCC=c++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-redhat-linux/12/lto-wrapper
Target: aarch64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --enable-libstdcxx-backtrace
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-12.2.1-20220819/obj-aarch64-redhat-linux/isl-install
--enable-gnu-indirect-function --build=aarch64-redhat-linux
--with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.1 20220819 (Red Hat 12.2.1-1) (GCC)

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

end of thread, other threads:[~2022-10-12 19:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-04  7:20 [Bug c++/106825] New: header unit <memory> based std::shared_ptr<...>(...) use gets: undefined reference to `std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release()', aarch64 example markmigm at gmail dot com
2022-09-04 16:38 ` [Bug c++/106825] " markmigm at gmail dot com
2022-09-04 17:14 ` markmigm at gmail dot com
2022-09-04 17:43 ` markmigm at gmail dot com
2022-09-04 18:41 ` markmigm at gmail dot com
2022-10-12 19:13 ` [Bug c++/106825] [modules] " ppalka 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).