Unable to use assign to fill a vector from data held by set.

pgCC is unable to compile the code shown below. This code attempts to fill a vector using the assign member function where the arguments to the function are iterators for a set. Both pgCC version 5.2-4 and 6.0-2 produce this error. Neither g++ (Linux) or cxx (Tru64) exhibit this problem.

// file: sample.cc
#include <set>
#include <vector>

int main()
{
    using namespace std;

    std::set<unsigned> su;
    std::vector<unsigned> vu;

    su.insert(1);
    su.insert(100);
    su.insert(99);

    vu.assign( su.begin(), su.end() );

    return 0;
}

Executing

pgCC –g sample.cc

produces the error

"/usr/local/pgi/linux86/6.0/include/CC/stl/_algobase.h", line 200: error: no
          suitable conversion function from
          "std::_Rb_tree_iterator<std::_Rb_tree<std::set<unsigned int,
          std::less<unsigned int>, std::allocator<unsigned int>>::key_type,
          std::set<unsigned int, std::less<unsigned int>,
          std::allocator<unsigned int>>::value_type,
          std::_Identity<std::set<unsigned int, std::less<unsigned int>,
          std::allocator<unsigned int>>::value_type>, std::set<unsigned int,
          std::less<unsigned int>, std::allocator<unsigned int>>::key_compare,
          std::allocator<unsigned int>>::value_type,
          std::_Const_traits<std::_Rb_tree<std::set<unsigned int,
          std::less<unsigned int>, std::allocator<unsigned int>>::key_type,
          std::set<unsigned int, std::less<unsigned int>,
          std::allocator<unsigned int>>::value_type,
          std::_Identity<std::set<unsigned int, std::less<unsigned int>,
          std::allocator<unsigned int>>::value_type>, std::set<unsigned int,
          std::less<unsigned int>, std::allocator<unsigned int>>::key_compare,
          std::allocator<unsigned int>>::value_type>>" to "const void *" exists
    return (_OutputIter)__copy_trivial(__first, __last, __result);

Any suggestions?

Hello kgt,

I sent this on to our compiler team, and sure enough, it’s a bug in our STL. Fortunately, it was an easy fix and should be available in our 6.1-3 release currently scheduled for March 2nd.

In the mean time you can fix the error by removing the comment at line 199 and then commenting out line 200 in the file “$PGI/linux86-64/6.1/include/CC/stl/_algobase.h”.

<   //  return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result));
<   return (_OutputIter)__copy_trivial(__first, __last, __result);
---
>     return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result));
>   //PGI conversion erorr:return (_OutputIter)__copy_trivial(__first, __last, __result);

Thank you for bring this to our attention,
Mat

FYI, I’ve confirmed that this issue (TPR#3736) has been fixed in 6.1-3.

  • Mat

Hi,

Our sysadmins finally installed PGI 6.1-3 and I tried to compile my sample code again. Unfortunately, the code still fails to compile:

% pgCC --version

pgCC 6.1-3 32-bit target on x86 Linux
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2006, STMicroelectronics, Inc. All Rights Reserved.

% pgCC -g sample.cc

“/opt/PGI/pgi_6.1-3/linux86/6.1/include/CC/stl/_algobase.h”, line 200: error:
no suitable conversion function from
“std::_Rb_tree_iterator<std::_Rb_tree<std::set<unsigned int,
std::less, std::allocator>::key_type,
std::set<unsigned int, std::less,
std::allocator>::value_type,
std::_Identity<std::set<unsigned int, std::less,
std::allocator>::value_type>, std::set<unsigned int,
std::less, std::allocator>::key_compare,
std::allocator>::value_type,
std::_Const_traits<std::_Rb_tree<std::set<unsigned int,
std::less, std::allocator>::key_type,
std::set<unsigned int, std::less,
std::allocator>::value_type,
std::_Identity<std::set<unsigned int, std::less,
std::allocator>::value_type>, std::set<unsigned int,
std::less, std::allocator>::key_compare,
std::allocator>::value_type>>” to “const void *” exists return (_OutputIter)__copy_trivial(__first, __last, __result);
^

Any other suggestions?

Hi kgt,

We did fix this for the 64-bit 6.1-3 pgCC STL but it appears we missed the 32-bit pgCC STL. Fortunately, it’s the same file for both targets so you can manually change the 32-bit file as shown above or copy “/opt/PGI/pgi_6.1-3/linux86-64/6.1/include/CC/stl/_algobase.h” to “/opt/PGI/pgi_6.1-3/linux86/6.1/include/CC/stl/_algobase.h”.

I have reopened TPR#3736 and sincerely appologize for this oversite.

  • Mat

Your fix didn’t make it into 6.1-4 either - 32-bit still has this issue.

Have you guys stopped working on 32-bit? Should we tell people to stop counting on PGI for 32-bit work now?

You often recommend to people that they edit .h files and the like.

Please understand that on many systems normal users do not have access to make these changes and getting a request to sys-admins to do so can be a huge time to wait.

It would be much better if you folks could just fix the software instead of letting things lapse and miss it in 2 subsequent releases.

Hi David,

You are quite right that it’s not the best advice, but the only work around available. I fully take the blame on this one since I misread kgt’s original post as applying only to 64-bits instead of 32-bits. 6.1-4 was released last week before we were aware of the mistake. As I indicated before, I have reopened the TPR and will ensure that the error is corrected.

Best Regards,
Mat