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

Internal error: assertion failed at: "shared/cfe/edgcpfe/decl_inits.c", line 588

Luke_D_
Beginner
1,418 Views

I am running into the following ICE with the following relatively minimalized test case.

Internal error: assertion failed at: "shared/cfe/edgcpfe/decl_inits.c", line 588

template <char>
struct Index {
  constexpr Index() : value_(0) {
  }

 private:
  int value_;
};

template <int>
int foo() {
  static constexpr Index<'i'> i;
  return 0;
}

int bar() {
  return foo<3>();
}

See versions below
 

[...]:~/test> gcc --version
gcc (GCC) 6.3.0 20161221 (Cray Inc.)
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[...]:~/test> icpc --version
icpc (ICC) 17.0.2 20170213
Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.

[...]:~/test> gcc -std=c++14 -c -o test.o test.cpp
[...]:~/test> icpc -std=c++14 -c -o test.o test.cpp
Internal error: assertion failed at: "shared/cfe/edgcpfe/decl_inits.c", line 588


compilation aborted for test.cpp (code 4)

This can be reproduced across lots of platforms and compiler versions, though this particular instance is in the Cray Linux Environment with PrgEnv-intel/6.0.3 and gcc/6.3.0

0 Kudos
5 Replies
TimP
Honored Contributor III
1,418 Views

This seems reproducible with various icpc versions including 18.0.0.061, regardless of whether the g++ on PATH is recent enough to accept the code.

0 Kudos
Judith_W_Intel
Employee
1,418 Views

 

Thank you for reporting this. I was able to reproduce it in our 18.0 and 17.0 compilers and have entered a bug report in our internal bugs database with number cmplrs-43144. We hope to have a fix soon.

Judy

0 Kudos
Tolmie__Shane
Beginner
1,418 Views

Just ran into the exact same problem again with Intel Compiler v19.0:

Internal error: assertion failed at: "shared/cfe/edgcpfe/exprutil.c", line 6647

The error appears to be random. The exact same code works perfectly fine if copied and pasted into another project.

0 Kudos
SUKLA
Beginner
1,311 Views
0 Kudos
Viet_H_Intel
Moderator
1,297 Views
I tried the code but didn't see the error with version 19.1.3.
 
$ icpc -std=c++14 t2.cpp -c -V
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.3.304 Build 20200925_000000
Copyright (C) 1985-2020 Intel Corporation.  All rights reserved.
Edison Design Group C/C++ Front End, version 5.0 (Sep 25 2020 02:11:08)
Copyright 1988-2018 Edison Design Group, Inc.
$ cat t2.cpp
template <char>
struct Index {
  constexpr Index() : value_(0) {
  }
 private:
  int value_;
};
template <int>
int foo() {
  static constexpr Index<'i'> i;
  return 0;
}
int bar() {
  return foo<3>();
}
$
0 Kudos
Reply