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

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

Beep123
Beginner
2,448 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
10 Replies
NoorjahanSk_Intel
Moderator
2,415 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.


0 Kudos
Beep123
Beginner
2,401 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

0 Kudos
NoorjahanSk_Intel
Moderator
2,374 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.


0 Kudos
Viet_H_Intel
Moderator
2,361 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.html


Thanks,


0 Kudos
Viet_H_Intel
Moderator
1,927 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


0 Kudos
hongtao1026
Beginner
1,791 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

 

0 Kudos
Viet_H_Intel
Moderator
1,757 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/1412265).

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

 

Thanks,

 

 

0 Kudos
Beep123
Beginner
1,513 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

0 Kudos
Viet_H_Intel
Moderator
1,505 Views

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


0 Kudos
Viet_H_Intel
Moderator
1,193 Views

Since Classic compiler will be removed second half of 2023. This issue will not be fixed. Please migrate to icx.

Thanks,


0 Kudos
Reply