ICE on variadic template code

ICE on variadic template code

Compile the following testcase with /opt/intel/composer_xe_2013_sp1.3.174/bin/intel64/icpc -O0 -std=c++11 -c

struct V {
  static constexpr int Size = 1;
};

template <typename To, typename From> inline To cast(From x);

template <int N, int = 1> struct sarray {
  typedef sarray<N / 2> S;
  sarray foo() const { const auto b = d.foo().bar(); }
  sarray bar() const { return {cast<S>(d)}; }
  S d;
};
template <int N> struct sarray<N, N> {
  static constexpr int Size = 1;
  sarray foo() const {}
  sarray bar() const {}
  V d;
};

template <typename To, typename From, typename... Froms>
inline To drop_arguments(Froms..., From, From);

template <typename To, typename From, typename... Froms>
inline To cast(From x, Froms... xs)
{
  using R0 = typename To::S;
  return {drop_arguments<R0, Froms...>(x, xs...)};
}

template <typename To, int N, typename... From>
inline To cast(const sarray<N, N> &x0, const From &... xs)
{
  return cast<To>(x0.d, xs.d...);
}

template <typename To, int N, int M, typename... From>
inline To cast(const sarray<N, M> &x0, const From &... xs)
{
  return cast<To>(x0.d, xs.d..., x0.d, xs.d...);
}

template <typename To, typename From, typename... Froms>
inline To drop_arguments(Froms..., From, From)
{
}

void test() { sarray<8>().foo(); }

​This is the output I get:
​icc-ice.cpp(37): internal error: assertion failed at: "shared/cfe/edgcpfe/func_def.c", line 1576

  {
  ^

compilation aborted for icc-ice.cpp (code 4)

PS: I tried to report this to Intel Premier Support, but once again that site is broken ... :-(

Vc: SIMD Vector Classes for C++
http://code.compeng.uni-frankfurt.de/projects/vc
5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Mathias,

I'll have a look at the ICE. What exactly was the Problem with the Intel Premier Support? Did you see an error message or just a Crash or was your Login rejected?

Regards, Hubert.

It said something about an invalid URL and that I should contact my admin. I couldn't make any sense of it...

Vc: SIMD Vector Classes for C++
http://code.compeng.uni-frankfurt.de/projects/vc

Matthias,

May have been a temporary problem. I do not see any issue with your account.

Could you please check again if you can log in to: https://premier.intel.com ? Please enter this URL manually, not from a Bookmark you may have stored. If the Problem persists, could you please take a screenshot and send it to me via 'Send Author A Message' link?

Hubert.

Matthias,

I can reprodcue the ICE with your variadic template sample. I'm going to file a defect.

Regards, Hubert

Leave a Comment

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