std::launder fails to link in PGI 19

Issue #297 resolved
Dan Bonachea created an issue

The following test program demonstrates std::launder is not correctly implemented in PGI 19.10 (backed by gcc 9.2.0).

#include <new>

#if __cplusplus < 201703
#error This test requires -std=c++17 or greater
#endif
#if __cpp_lib_launder != 201606 
// see https://en.cppreference.com/w/cpp/feature_test
#error __cpp_lib_launder missing or not correctly set
#endif

int main() {
  int x = 4;
  int *p1 = &x;
  int *p2 = std::launder(p1);
  return *p2;
}

The C++17 library was first available in PGI 19.4, but this function appears to be broken in every version where it's available, backed by a variety of modern g++ - on dirac:

$ g++ --version
g++ (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ -pedantic -std=c++17 std-launder.cc
$ /usr/local/pkg/pgi/linux86-64/19.4/bin/pgc++ -pedantic -std=c++17 std-launder.cc
/tmp/pgc++cCsdgoJZg75-.o: In function `int* std::launder<int>(int*)':
/usr/local/pkg/gcc/8.3.0/include/c++/8.3.0/new:197: undefined reference to `__builtin_launder'
$ /usr/local/pkg/pgi/linux86-64/19.5/bin/pgc++ -pedantic -std=c++17 std-launder.cc 
/tmp/pgc++fLsdpjVmKyD9.o: In function `int* std::launder<int>(int*)':
/usr/local/pkg/gcc/8.3.0/include/c++/8.3.0/new:197: undefined reference to `__builtin_launder'
$ /usr/local/pkg/pgi/linux86-64/19.7/bin/pgc++ -pedantic -std=c++17 std-launder.cc 
/tmp/pgc++mVsdKghJZbEw.o: In function `int* std::launder<int>(int*)':
/usr/local/pkg/gcc/9.1.0/include/c++/9.1.0/new:193: undefined reference to `__builtin_launder'
$ /usr/local/pkg/pgi/linux86-64/19.9/bin/pgc++ -pedantic -std=c++17 std-launder.cc 
/tmp/pgc++l3sdHzeKZPwf.o: In function `int* std::launder<int>(int*)':
/usr/local/pkg/gcc/9.2.0/include/c++/9.2.0/new:193: undefined reference to `__builtin_launder'
$ /usr/local/pkg/pgi/linux86-64/19.10/bin/pgc++ -pedantic -std=c++17 std-launder.cc 
/tmp/pgc++pctdTA7N5tbH.o: In function `int* std::launder<int>(int*)':
/usr/local/pkg/gcc/9.2.0/include/c++/9.2.0/new:193: undefined reference to `__builtin_launder'
$ /usr/local/pkg/pgi/linux86-64/19.10/bin/pgc++ --version

pgc++ 19.10-0 LLVM 64-bit target on x86-64 Linux -tp nehalem 
PGI Compilers and Tools
Copyright (c) 2019, NVIDIA CORPORATION.  All rights reserved.

I'll be reporting this PGI bug to them.

This bug is responsible for issue #289

Comments (4)

  1. Dan Bonachea reporter

    Response from Alex at PGI:

    Thanks. Looks like a bug on our end, I’ve filed TPR #28031 to track. I don’t have an immediate workaround though, let me see what our C++ developer has to say.

  2. Dan Bonachea reporter

    PGI 20.1 has been released and claims to fix this TPR.

    I've verified the reproducer program passes on the cori/gpu install

  3. Log in to comment