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

            Bug ID: 119849
           Summary: libgomp.c++/allocator-1.C etc. FAIL
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---
            Target: *-*-solaris2.11

Two new libgomp tests FAIL on Solaris, both sparc and x86, 32 and 64-bit:

+FAIL: libgomp.c++/allocator-1.C execution test
+FAIL: libgomp.c++/allocator-2.C execution test

The abort with

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Thread 2 received signal SIGABRT, Aborted.
[Switching to Thread 1 (LWP 1)]
0xfe02e845 in __lwp_sigqueue () from /lib/libc.so.1
(gdb) bt
#0  0xfe02e845 in __lwp_sigqueue () from /lib/libc.so.1
#1  0xfe02654f in thr_kill () from /lib/libc.so.1
#2  0xfdf61e22 in raise () from /lib/libc.so.1
#3  0xfdf2f452 in abort () from /lib/libc.so.1
#4  0xfe3126a3 in __gnu_cxx::__verbose_terminate_handler ()
    at
/builds/ulhg/mrcarson-trunk_194/components/gcc14/gcc-14.2.0/libstdc++-v3/libsupc++/vterminate.cc:95
#5  0xfe30ef03 in __cxxabiv1::__terminate (
    handler=0xfe3126e0 <__gnu_cxx::__verbose_terminate_handler()>)
    at
/builds/ulhg/mrcarson-trunk_194/components/gcc14/gcc-14.2.0/libstdc++-v3/libsupc++/eh_terminate.cc:48
#6  0xfe30ef71 in std::terminate ()
    at
/builds/ulhg/mrcarson-trunk_194/components/gcc14/gcc-14.2.0/libstdc++-v3/libsupc++/eh_terminate.cc:58
#7  0xfe30f278 in __cxxabiv1::__cxa_throw (obj=0x8088718, 
    tinfo=0xfe4bd710 <typeinfo for std::bad_alloc>, 
    dest=0xfe30c660 <std::bad_alloc::~bad_alloc()>)
    at
/builds/ulhg/mrcarson-trunk_194/components/gcc14/gcc-14.2.0/libstdc++-v3/libsupc++/eh_throw.cc:98
#8  0xfe341e83 in std::__throw_bad_alloc ()
    at
/builds/ulhg/mrcarson-trunk_194/components/gcc14/gcc-14.2.0/libstdc++-v3/src/c++11/functexcept.cc:54
#9  0x0807381b in omp::allocator::__detail::__allocator_templ<int,
(omp_allocator_handle_t)200>::allocate (this=0xfeffdb07, __n=1)
    at
/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/./libgomp/omp.h:464
#10 0x080729e1 in std::allocator_traits<ompx::allocator::gnu_pinned_mem<int>
>::allocate (__a=..., __n=1)
    at
/var/gcc/regression/master/11.4-gcc/build/i386-pc-solaris2.11/libstdc++-v3/include/bits/alloc_traits.h:385
#11 0x0806d132 in test<int, ompx::allocator::gnu_pinned_mem> (initial_value=42)
    at
/vol/gcc/src/hg/master/local/libgomp/testsuite/libgomp.c++/allocator-1.C:32
#12 0x0806c200 in main ()
    at
/vol/gcc/src/hg/master/local/libgomp/testsuite/libgomp.c++/allocator-1.C:124

This is the same problem that caused PR libgomp/113448: gnu_pinned_mem is only
supported on a
few select targets, apparently linux, gcn, and nvptx (which have
implementations
in config/*/allocator.c).

While Solaris does have mlock, too, it's only available with the
PRIV_PROC_LOCK_MEMORY
privilege which is *not* available for regular users.

Here's what I suspect should happen:

* The gnu_pinned_mem subtests should be split off into their own files so that
  the rest of the tests can still be run on non-Linux targets.

* Those new tests should be guarded with a new effective-target keyword.  At
  the moment, some tests are skipped or xfailed on non-Linux with

  /* { dg-skip-if "Pinning not implemented on this host" { ! *-*-linux-gnu* }
  } */

  or

  ! { dg-xfail-run-if "Pinning not implemented on this host" { ! *-*-linux-gnu*
} }

  This doesn't seem appropriate, though, since it's likely to miss other
targets
  also implementing pinned memory.

Reply via email to