Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

internal error: assertion failed: copy_template_param_expr:

gkmohan12
Beginner
550 Views
Exact Error:
=================
../mesh/linunimesh1d.h(42): internal error: assertion failed: copy_template_param_expr: bad expression kind (shared/edgcpfe/il.c, line 12557)

typedef typename True_Element::template Subshape::type Shape;
=================


Relevant definitions:
=====================
#define IF_EQUAL(Subshape_Tag, Shape_Tag)
typename bool_<:SHAPE_CLASS>::type

public:
template struct Subshape;
template
struct Subshape
{
typedef Node type;
};
template
struct Subshape
{
typedef Edge type;
};
template
struct Subshape
{
typedef Face type;
};

typedef typename True_Element::template Subshape::type Shape;
====================
0 Kudos
5 Replies
TimP
Honored Contributor III
550 Views
You haven't given much to go on. Did this fail only as part of a huge source file? If you want this investigated, you should file the problem report on premier.intel.com. Guessing that the compiler may have overflowed some internal table, you might try disabling interprocedural optimization or splitting the source file.
0 Kudos
gkmohan12
Beginner
550 Views
tim18:
You haven't given much to go on. Did this fail only as part of a huge source file? If you want this investigated, you should file the problem report on premier.intel.com. Guessing that the compiler may have overflowed some internal table, you might try disabling interprocedural optimization or splitting the source file.


Sorry, I should have filed a better bug report, but I thought the problem was described enough that a test case could be easily generated.

My hunch is that, the error could be due to some hardcoded size limit for template expression string. I attach two files they are equivalent conceptually but one reads more complicated than other. The simple one works ("intel_nobug.cc"), while the complex one fails ("intel_bug.cc")

===intel_nobug.cc===
template
struct is_same
{
typedef void type;
};

template
struct is_same
{
typedef bool type;
};

struct A
{
template struct AS;
template
struct AS::type>
{
typedef int type;
};
template
struct AS::type>
{
typedef double type;
};
};

template
struct B
{
typedef typename A::template AS::type type;
};

main()
{
B b;
}
===intel_nobug.cc===



===intel_bug.cc===
template
struct integral_constant
{
typedef integral_constant type;
typedef T value_type;
static const T value = val;
};

struct true_ : public integral_constant {
typedef true_ type;
};

struct false_ : public integral_constant {
typedef false_ type;
};

template struct bool_;
template<> struct bool_ : public true_ {};
template<> struct bool_ : public false_ {};






enum shape_class_t {ST_NONE, NODE, EDGE, FACE, FOLD};

struct Node_Tag
{
typedef Node_Tag Shape_Tag;
static const shape_class_t shape_class = NODE;
static const shape_class_t previous_class = ST_NONE;
static const shape_class_t next_class = EDGE;
};
struct Edge_Tag
{
typedef Edge_Tag Shape_Tag;
static const shape_class_t shape_class = EDGE;
static const shape_class_t previous_class = NODE;
static const shape_class_t next_class = FACE;
};




#define IF_EQUAL(Subshape_Tag, Shape_Tag)
typename bool_<:SHAPE_CLASS>::type

struct Node {};
struct Edge {};

struct Element
{
template struct Subshape;
template
struct Subshape
{
typedef Node type;
};
template
struct Subshape
{
typedef Edge type;
};
};

template
struct Some
{
typedef typename Element::template Subshape::type Shape;
};

main()
{
Some s;
}
===intel_bug.cc===

0 Kudos
Dale_S_Intel
Employee
550 Views
Thanks for the test case. I seem to be reproducing the problem, let me investigate and I'll get back to you.

Dale
0 Kudos
gkmohan12
Beginner
550 Views
Any update on this.
0 Kudos
Judith_W_Intel
Employee
550 Views

Thank you for reporting this bug. I have entered it into our internal bug

database (tracker number #82149). The problem seems to occur when

trying to copy the static data member part of the template expression inside

the IF_EQUAL macro. To workaround it, you might try changing your code

as shown in this diff:

Change the code as shown below (this removes the
use of the static data members in the template argument
expression):

sptxl2-424> diff -c intel_bug.cc fixed.cc
*** intel_bug.cc2007-12-27 21:59:28.000000000 -0500
--- fixed.cc2007-12-27 22:16:19.000000000 -0500
***************
*** 34,54 ****


#define IF_EQUAL(Subshape_Tag, Shape_Tag)
!typename bool_<:SHAPE_CLASS>::type

struct Node {};
struct Edge {};

struct Element
{
!template struct Subshape;
template
!struct Subshape
{
typedef Node type;
};
template
!struct Subshape
{
typedef Edge type;
};
--- 34,54 ----


#define IF_EQUAL(Subshape_Tag, Shape_Tag)
!bool_<:SHAPE_CLASS>

struct Node {};
struct Edge {};

struct Element
{
!template > struct Subshape;
template
!struct Subshape
{
typedef Node type;
};
template
!struct Subshape
{
typedef Edge type;
};

thanks again for reporting this to us.

Judy

0 Kudos
Reply