Warning #1879: unimplemented pragma ignored

Warning #1879: unimplemented pragma ignored

Please take a look:

../PrtTests.cpp(2672): warning #1879: unimplemented pragma ignored

#pragma intrinsic ( _ReadWriteBarrier )
^

Why a fundamental feature is not implemented?

Development Environment:

OS: Windows XP 32-bit
IDE: Visual Studio 2005 SP1
Compilers: Intel C++ / Microsoft C++ / Borland C++ / MinGW / Turbo C++

Best regards,
Sergey

12 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

The pragma is implemented in Intel Compiler 12.1.

// tstcase.cpp

#include

# pragma intrinsic (_InterlockedExchangeAdd64)

volatile __int64 electronic_city;

int main()

{

__int64 somet;

somet = InterlockedExchangeAdd64(&electronic_city, 0);

return 0;

}

c:\ISSUES\>icl -c tstcase.cpp

Intel C++ Intel 64 Compiler XE for applications running on Intel 64, Version 12.1.1.258 Build 20111011

Copyright (C) 1985-2011 Intel Corporation. All rights reserved.

tstcase.cpp

-------------------------

It would be nice if you can provide a testcase to reproduce the issue.

Didyou try to compile your Test-Case when a Warning Level is set to5?

Here are two Test-Cases:

// For Sub-Test 1
#pragma intrinsic( _ReadWriteBarrier )
int g_iVariable = 0;								// Declared as global
// For Sub-Test 2
#pragma intrinsic( _InterlockedExchangeAdd )
volatile LONG g_lVolatileVar = 0;
...
// Sub-Test 1 - Verification of _ReadWriteBarrier intrinsic function

{

///*

	#define _USE_READWRITEBARRIER
	int *piData = NULL;

	g_iVariable = *piData;

	#if defined ( _USE_READWRITEBARRIER )

	_ReadWriteBarrier();

	#endif

	g_iVariable = 7;							// Creates an Access Violation
	#endif

//*/

}

// Sub-Test 2 - Verification of _InterlockedExchangeAdd intrinsic function

{

///*

	LONG lInitVal = _InterlockedExchangeAdd( &g_lVolatileVar, 55 );

//*/

}
...

Intel C++ compiler version:

Intel C++ Compiler XE 12.1.3.300 [IA-32]

Intel C++ compiler command line options:

/c /Od /D "WIN32" /D "_CONSOLE" /D "_DEBUG" /D "_VC80_UPGRADE=0x0710"
/D "_UNICODE" /D "UNICODE" /GF /EHsc /RTC1 /MTd /GS /fp:precise /W5 /nologo /ZI /TP
/Qopenmp /Qdiag-disable:111,673

Best regards,
Sergey

Here is a screenshot ( the Warning 1879 is generated in both cases ):

I am still not able to reproduce. I have compiled your testcase without any issue.

c:\forum\U105045>type tst.cpp

#include

#include

// For Sub-Test 1

#pragma intrinsic( _ReadWriteBarrier )

int g_iVariable = 0; // Declared as global

// For Sub-Test 2

#pragma intrinsic( _InterlockedExchangeAdd )

volatile LONG g_lVolatileVar = 0;

// Sub-Test 1 - Verification of _ReadWriteBarrier intrinsic function

void foo1()

{

///*

#define _USE_READWRITEBARRIER

int *piData = NULL;

g_iVariable = *piData;

#if defined ( _USE_READWRITEBARRIER )

_ReadWriteBarrier();

#endif

g_iVariable = 7; // Creates an Access Violation

//#endif

//*/

}

void foo2()

// Sub-Test 2 - Verification of _InterlockedExchangeAdd intrinsic function

{

///*

LONG lInitVal = _InterlockedExchangeAdd( &g_lVolatileVar, 55 );

//*/

}

c:\forum\U105045> icl -c /Od /D "WIN32" /D "_CONSOLE" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /GF /EHsc /RTC1 /MTd /GS /fp:precise /W3 /ZI /TP tst.cpp

Intel C++ Compiler XE for applications running on IA-32, Version 12.1.1.258 Build 20111011

Copyright (C) 1985-2011 Intel Corporation. All rights reserved.

tst.cpp

I am still not able to reproduce. I have compiled your testcase without any issue.

...
c:\forum\U105045> icl -c /Od /D "WIN32" /D "_CONSOLE" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /GF /EHsc /RTC1 /MTd /GS /fp:precise /W3 /ZI /TP tst.cpp
...

Please change /W3 to /W5.

Best regards,
Sergey

Best Reply

I have reproduced the issue and submitted a report on this to Intel compiler development team. I will update the thread when I have more information on this.

Thank you, Om!

Best regards,
Sergey

Hello there, I am facing to similar problem. I am using Boost 1.49 libraries, compiled by Intel compiler 12.1. Within compiling process, the same (several) warnings appear:


#pragma intrinsic

Warning #1879: unimplemented pragma ignored

In my code I use the following class:
[c++]template
class Interlocked {
volatile LONG myValue;
public:
Interlocked(ArithmeticType val = 0) : myValue(val) {}
ArithmeticType operator =(ArithmeticType newVal) { return (ArithmeticType)::InterlockedExchange(&myValue, (LONG)newVal); }
ArithmeticType operator ++() { return (ArithmeticType)::InterlockedIncrement(&myValue); }
ArithmeticType operator --() { return (ArithmeticType)::InterlockedDecrement(&myValue); }
ArithmeticType operator +=(ArithmeticType val) { return (ArithmeticType)::InterlockedExchangeAdd(&myValue, (LONG)val) + val; }
ArithmeticType operator -=(ArithmeticType val) { return (ArithmeticType)::InterlockedExchangeAdd(&myValue, (LONG)(-val)) - val; }
bool operator ==(ArithmeticType val) const { return ::InterlockedCompareExchange(const_cast(&myValue), (LONG)val, (LONG)val) == (LONG)val; }
operator ArithmeticType() const { return (ArithmeticType)myValue; }
/**
* Sets the newVal iff the original value was equal to comparand; leaves the original value otherwise.
* Returns true iff the exchange was actually performed.
*/
bool compareExchange(ArithmeticType newVal, ArithmeticType comparand) { return ::InterlockedCompareExchange(&myValue, (LONG)newVal, (LONG)comparand) == (LONG)comparand; }
};

template
Interlocked::operator bool() const {
return operator ==(true);
}[/c++]

In other class I define "Interlocked" variable like this:
Interlocked myIsShutdownRequested;
This variable is accessed in multi-threaded environment. Sometimes in the place where the variable is accessed I get "AccessViolation" exception.
Please, do you have an update from Intel development forum? Thank you very much!

Please take a look at a Post #7. Some time ago Om submitted a report.

Be aware that even though the Intel compiler does not currently implement this pragma it doesnt usually mean there will be a problem in your code. The compiler will still recognize the intrinsics (such as _ReadWriteBarrier and _InterlockedExchangeAdd64) and expand or call them as needed. So for most users this warning when related to #pragma intrinsic is nothing to worry about.

Leave a Comment

Please sign in to add a comment. Not a member? Join today