Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7599 Discussions

internal error: ** The compiler has encountered an unexpected problem

Beep123
Beginner
414 Views
 
class Wrapper {
public:
    consteval Wrapper(int a) {
        if (a == 0) Error("Error");
    }
    void Error(const char* str) {}
};

void Foo(const Wrapper& wrapper) {
}

int main() {
    Foo(0);
}

Example: https://godbolt.org/z/6aedWMcYa

 

Labels (1)
0 Kudos
4 Replies
NoorjahanSk_Intel
Moderator
381 Views

Hi,


Thanks for reaching out to us.


As you are using consteval in your source code, if a function or a function template is defined by a consteval specifier then all declarations within that function should contain the same specifier.

As 'wrapper' is specified by consteval specifier in your source code, then the 'Error' function should also be specified by consteval.


Could you please try changing the below line

void Error(const char* str) {}

to

consteval void Error(const char* str) {}


if you still face any issues, please do let us know with a complete error log along with the compiler version that is being used.


Thanks & Regards,

Noorjahan.


Beep123
Beginner
367 Views

Hi,

 

the Error function isn't consteval on purpose. With Foo(1) it should compile and with Foo(0) it should produce an error, but of course no segmentation fault. We use it to do some checks for strings during compile time. This is just a rather simplified example to demonstrate the problem. With MSVC, clang, gcc and icx it's working as expected.

 

You can check it with compiler explorer: https://godbolt.org/z/6aedWMcYa

 

icc --version: icc (ICC) 2021.3.0 20210609

Compiler Error Output:

": internal error: ** The compiler has encountered an unexpected problem.
** Segmentation violation signal raised. **
Access violation or stack overflow. Please contact Intel Support for assistance.
 
icc: error #10105: /opt/compiler-explorer/intel-cpp-2021.3.0.3168/compiler/2021.3.0/linux/bin/intel64/../../bin/intel64/mcpcom: core dumped
icc: warning #10102: unknown signal(0)
icc: error #10106: Fatal error in /opt/compiler-explorer/intel-cpp-2021.3.0.3168/compiler/2021.3.0/linux/bin/intel64/../../bin/intel64/mcpcom, terminated by unknown
compilation aborted for <source> (code 1)
Compiler returned: 1

 

Regards

Beep123

NoorjahanSk_Intel
Moderator
340 Views

Hi,

Thanks for providing the details.

We are also able to reproduce the issue from our end.

We are working on it, we will get back to you soon.


Thanks & Regards,

Noorjahan.


Viet_H_Intel
Moderator
327 Views

I've reported this bug to our Developer.

Not sure if you are aware, but Intel C++ Classic Compiler will enter "Legacy Product Support" mode signaling the end of regular update.

Please see this article for details. https://www.intel.com/content/www/us/en/developer/articles/technical/adoption-of-llvm-complete-icx.h...


Thanks,


Reply