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

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

Beep123
Beginner
1,170 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
9 Replies
NoorjahanSk_Intel
Moderator
1,137 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
1,123 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
1,096 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
1,083 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,


Viet_H_Intel
Moderator
649 Views

Hi,


This problem is fixed in icpc2021.6 (oneAPI2022.2 HPC toolkit). Please upgrade your compiler to this one.

We are going to close this thread.


Thanks,

Viet


hongtao1026
Beginner
513 Views

Hi,I also meet the same problem even though I upgrade my compiler to oneAPI2022.2. How can I fix this problem?

hongtao1026_0-1662807279981.png

 

Viet_H_Intel
Moderator
479 Views

Hi,

This should be a different issue. However, C++ Classic Compiler will be deprecated in 2023 (https://community.intel.com/t5/Intel-C-Compiler/DEPRECATION-NOTICE-Intel-C-Compiler-Classic/td-p/141...

Please try with icx, if the problem still occurs, please create a new thread with a test case for us to investigate. 

 

Thanks,

 

 

Beep123
Beginner
235 Views

Hi,

 

the problem isn't really fixed. With icpc2021.6 the compiler is no longer crashing, but compiling the code without any error: https://godbolt.org/z/Mx4YT78zv  which is wrong, too.

 

The correct behaviour would be to generate an error, like icx, clang or gcc: https://godbolt.org/z/Mjaz7joae

 

Regards
Beep123

Viet_H_Intel
Moderator
227 Views

Thanks for discover that. I'll report it to the development team.


Reply