assembler errors during C++ compilation

Hi,

Compilation of a C++ program (attached at the end) fails with the following errors:

PGCC-W-0155-No va_start() seen (/opt/pgi/6.1.4/linux86-64/6.1/include/CC/iostream: 689)
PGCC/x86 Linux/x86-64 6.1-4: compilation completed with warnings
/tmp/pgCCbaaaastFaB.s: Assembler messages:
/tmp/pgCCbaaaastFaB.s:2502: Error: junk (%rbx)' after expression /tmp/pgCCbaaaastFaB.s:2503: Error: junk (%rbx)’ after expression


I do not use any extra compiler options other than -Iinclude_path.

Here are my configuration details:
$ pgCC --version
pgCC 6.1-4 64-bit target on x86-64 Linux
$ uname -a
Linux tg-login5 2.6.5-7.276-ss #7 Thu Oct 12 13:52:17 PDT 2006 x86_64 x86_64 x86_64 GNU/Linux



I have tried to narrow it down to as minimal as possible a sample C++ code. Eventually, I couldn’t avoid using several header only libraries. The libraries are from Boost.org, using Boost.Lambda and Boost.Function. They are widely and freely available from www.boost.org. The caveat is that Boost doesn’t provide support for PG compilers, but for the most part I was able to make it work for these libraries: All tests provided in their distribution passed (for Boost.Lambda and Boost.Function). I you’d like to try my sample code it would suffice to install Boost using gcc toolset. And, again, since these are header only libraries no linkage is necessary to an external library.

(highlighted code is here: http://rafb.net/p/28TknK25.html )

// ========================================
#include <boost/function.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/lambda/casts.hpp>
#include <iostream>


// Some struct of only double members
struct A
{
  double a;
  double b;
};



// The "complicated" function that expect a functor to
// operate on an instance of A
template< class Func > void foo(const Func& f, const A& a)
{
  std::cout << f(a) << std::endl;
}



// A function object generator.
// It returns a functor which in turn returns some
// double member of A accessed via address offset
boost::function<double(const A&)> getmem
(
const A* obj,
const double* mem
)
{
  ptrdiff_t shift = mem -
     reinterpret_cast<const double*>(obj);
  using namespace boost::lambda;
  return *(ll_reinterpret_cast<const double*>(&_1)
   + constant(shift) );
}


//
int main()
{
  A obj;
   obj.a = 1.;
  obj.b = 2.;
  //
  foo( getmem(&obj, &obj.b), obj );
  return 0;
}

// wherever this compiles, it prints out "2".  
// ==========================================

You might argue that the code looks weird and overly indirect in what it tries to do. However it is a valid C++ code and it does compile and run correctly on other compilers (I tried MSVC++ 7.1, gcc 3.3.3, gcc 4.0.2 and hpCC x.x)…

The assembler code that pgCC generates and issues the errors are here
http://rafb.net/p/LW5IX765.html – lines 7 and 8.

thx

  • Levent

Hi Levent,

It appears that two of the pgcpp manged names coming out of the Boost headers are too long for the assembler. I’ve filed a report (TPR#4037) and we’ll have a compiler engineer take a look.

Note that we don’t support Boost yet, but I’ve requested that our compiler team make it a priority this year.

Thanks,
Mat