Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

problem moving to icc 17 (from 16 and 15)

$
0
0

Hi,

I was trying to get going with 17 (version 17.0.0.109) and I'm coming from 15.0 and 16.0 (versions 15.0.3.208 and 16.0.3.207) which are all hosted under vc11 using vc11 compatibility mode. I have a fair-sized code base that takes about an hour to compile and everything built fine but one part where I got a strange looking undefined symbol linker error. It was strange in that the demangled name was the same as the mangled name. 

I spent some time getting an example down to the smallest possible code that exhibits the problem and what appears to happen is, while compiling with optimization on (-O3) if I use a #pragma optimize(“”, off) and then refer to an in line method the symbol name seems to be incorrectly mangled.  This comes out of a pretty large and complicated build but I’ve whittled it down to the smallest example I can make. The “missing” symbol is the operator!=.

Here's the code in question:

define DLLAPI _declspec( dllimport )

class DLLAPI PStatus
{
public:
	enum PStatusCode
	{
		kSuccess = 0,
		kFailure,
	};
    PStatus();

	friend DLLAPI inline bool operator!=( const PStatus::PStatusCode code,
                                               const PStatus& status )
	{
		return ( status.fStatusCode != code );
	}

private:
	unsigned char		fStatusCode;
};

#pragma optimize("", off)

int
initialize()
{
    PStatus status;

	if ( PStatus::kSuccess != status )
	{
		return 1;
	}
    return 0;
}

If I compile that with icc 17 with -O3 I see the following symbol with dumpbin, notice the non-demangled name:

009 00000000 UNDEF  notype       External     | __imp_??9..0@YA_NW4PStatusCode@PStatus@@AEBV1@@Z (__declspec(dllimport) ??9..0@YA_NW4PStatusCode@PStatus@@AEBV1@@Z)

If compiled with icc 17 with -Od I get this:

009 00000000 UNDEF  notype       External     | __imp_??9@YA_NW4PStatusCode@PStatus@@AEBV1@@Z (__declspec(dllimport) bool __cdecl operator!=(enum PStatus::PStatusCode,class PStatus const &))

Compared to either icc 15 or icc 16 with -O3 I get:

009 00000000 UNDEF  notype       External     | __imp_??9@YA_NW4PStatusCode@PStatus@@AEBV1@@Z (__declspec(dllimport) bool __cdecl operator!=(enum PStatus::PStatusCode,class PStatus const &))

The class definition is not my code and I can't change it. If you remove the declspec(dllimport) the symbol looks normal again but I can't test that since it's not my code.

Cheers,

James

Zone: 

Thread Topic: 

Bug Report

Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>