Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel_V_2
Beginner
73 Views

internal error: assertion failed at: "shared/cfe/edgcpfe/lower_name.c", line 8667 (ICC Version 15.0.0)

I seem to have uncovered yet another internal compiler error with the current 15.0.0 Intel C++ compiler (using C++11):

#include <cstdio>

template<class Functor, typename IndexT, void (Functor::*MemberFunction)(const IndexT) const>
void LoopMemberFunction(const IndexT start, const IndexT end, const Functor &f)
{
  for (IndexT i = start; i < end; ++i)
    (f.*MemberFunction)(i);
}

template<class Functor>
void Loop(const int start, const int end, const Functor &f)
{
  LoopMemberFunction<Functor, int, &Functor::operator()>(start, end, f);
}

int main(int argc, char const *argv[])
{
	Loop(0, argc, [](const int i)
	{
		printf("%i\n", i);
	});
	return 0;
}

 

Compiling the above code using

$ icpc -std=c++11 test.cpp
test.cpp(23): internal error: assertion failed at: "shared/cfe/edgcpfe/lower_name.c", line 8667


compilation aborted for test.cpp (code 4)


It seems to be the combination of lambdas (anonymous functors) and member function pointers that seem to trigger this bug.

Is there any known workaround?

 

0 Kudos
3 Replies
pbkenned1
Employee
73 Views

I can reproduce this, but on Linux only.  Windows is OK.  The ICE appears to be triggered in the compiler front end, and I haven't found a workaround.  I'll investigate a bit more and report to the developers.

Patrick

Judith_W_Intel
Employee
73 Views

 

This has been entered in our bug tracking database as DPD200363913.

A possible workaround is to send in the call operator as a function argument instead of a nontype template argument, i.e. look at the code inside the #ifdef OK below:

#ifdef OK
template<class Functor, typename IndexT>
void LoopMemberFunction(const IndexT start, const IndexT end, const Functor &f,
                        void (Functor::*MemberFunction)(const IndexT) const)
#else
template<class Functor, typename IndexT, void (Functor::*MemberFunction)(const IndexT) const>
void LoopMemberFunction(const IndexT start, const IndexT end, const Functor &f)
#endif
{
  for (IndexT i = start; i < end; ++i)
    (f.*MemberFunction)(i);
}

template<class Functor>
void Loop(const int start, const int end, const Functor &f)
{
#ifdef OK
  LoopMemberFunction<Functor, int>(start, end, f, &Functor::operator());
#else
  LoopMemberFunction<Functor, int, &Functor::operator()>(start, end, f);
#endif
}

The code inside the #ifdef OK compiles and executes as expected although it does give a bogus remark "Possible access beyond allocated symbol" which I think you can safely disable/ignore.

Thank you for reporting it to us.

Judy

pbkenned1
Employee
73 Views

This is resolved in IPS XE 2015 update 2, so I am closing this ticket now.

Patrick

[U536635]$ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.2.164 Build 20150121
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

[U536635]$  icpc -std=c++11 foo.cpp -o foo.cpp.x
[U536635]$ ./foo.cpp.x
0
[U536635]$

Reply