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

Very strange error related to scoped enums and constexpr functions

Raffael_C_
Beginner
311 Views

Hi,

I recently came across a very nasty behaviour of Intel of which I'm almost sure that it is a bug. It is kind of difficult to describe and I'm not sure what is actually causing it. However I've managed to reduce the problem from about 2000 lines of code to about 50 lines of code and I don't seem to be able to reduce it even more. As soon as I change another line the error seems to be gone.

I've attached those 50 lines to this message in the hope that someone else could test it with his configuration. I'm using Intel Composer XE2014 , Version 14.0.0.103 on Windows (x64). The error message that I get is:

[cpp]

1>IntelConstexpr.cpp(18,29): error : assertion failed: scan_routine: unexpected IL entry (shared/cfe/edgglue/edg_main.c, line 492)

[/cpp]

Note that the error message of intel is very unspecific, it doesn't say anything about the problem (at least I don't understand it at all;)

I should also mention that the same code compiles with clang3.3 and gcc 4.8.1 on linux so I believe it is c++11 conforming.

Thanks,

craffael

0 Kudos
5 Replies
TimP
Honored Contributor III
311 Views

 It seems to work here.  Did you have the same g++ active under icpc as when you tested g++?

0 Kudos
Raffael_C_
Beginner
311 Views

Thanks for testing it out :)

well the problem appeared on my windows machine on which g++ is not installed. However on the linux workstation I have g++ and clang and there the same code worked flawlessly. Did you try it under windows? And if so, what is exactly your compiler version? I believe I have the latest version but maybe I'm wrong ;)

0 Kudos
Melanie_B_Intel
Employee
311 Views

The "assertion" diagnostic basically menas that the compiler has internal consistency checks which have failed.

When i run your test case with either icl or cl, there are 2 error messages that are produced. I tried with vs2010, 2012 and 2013

Can you provide us with a preprocessed file and the command line that you used?  Which version of visual studio are you using? (Adding -E to the compilation line with produce the preprocessed output on standard out). Please also show the command line so we can see what options you used.

0 Kudos
Raffael_C_
Beginner
311 Views

Hmm very interesting, I was unable to reproduce the error when compiling the application directly from the command line using intel compiler, it seems to work only when the Intel compiler is used through Visual Studio 2012. I have therefore attached my whole (minimal) visual studio 2012 solution with which the compilation fails in the hope that it allows you to reproduce the error as well...

In addition I have created the preprocessed file and attached it to this message as well...

Just a side note: If I compile the source from the command-line, I get the following error: 

[cpp]

IntelConstexpr.cpp(24): error: expression must have a constant value
static const int value = numSubEntities(codim);

[/cpp]

However I believe that this is actually correct code (since numSubEntities() is a constexpr and because the code compiles successfully on gcc and clang)

0 Kudos
Melanie_B_Intel
Employee
311 Views

The compiler is having an issue with the ? : inside the constexpr function, DPD200249239 is tracking that issue. Thank you for the bug report and test case.

0 Kudos
Reply