Community
cancel
Showing results for 
Search instead for 
Did you mean: 
vzecca
Beginner
322 Views

icpx -fpermissive ICE in IntExprEvaluator::VisitCastExpr

The following code provokes an ICE in icpx Version 2021.1 NextGen Beta Build 20200304

// icpx -fpermissive ICE in IntExprEvaluator::VisitCastExpr
enum E { EA, EB };

struct A { E e: 8; };

A a = { 0 };

Labels (1)
0 Kudos
4 Replies
PrasanthD_intel
Moderator
308 Views

Hi Vittorio,


Thanks for reaching out to us.

You are getting an error because you cannot convert an enum into int type a. 

But since you are using -fpermissive, it will make the compiler to report some things that are actually errors (but are permitted by some compilers) as warnings, to permit code to compile even if it doesn't conform to the language rules.


You will get the same error with g++, icpc or clang++.

What is the use case you are trying to achieve?


Regards

Prasanth


vzecca
Beginner
298 Views

g++ -fpermissive compiles with a warning, while icpc -fpermissive compiles without warnings.

This snippet code is part of a huge code that compiles and run with g++ -fpermissive

AND with icpc -fpermissive.

I do not understand why icpx crashes, instead of just giving an error message

and gracefully terminate.

Viet_H_Intel
Moderator
286 Views

The compiler shouldn't give you a core dump. I'll report that to our Developer.

If you have later icpx version, then -fpermissive (for gnu extension for non conformant code) won't longer be supported (I think it's because clang doesn't support it)

$ cat t4.cpp

enum E { EA, EB };


struct A { E e: 8; };


A a = { 0 };


$ icpc t4.cpp -fpermissive -c

$ g++ t4.cpp -fpermissive -c

t4.cpp:5:11: warning: invalid conversion from ‘int’ to ‘E’ [-fpermissive]

 A a = { 0 };

      ^

$ clang++ t4.cpp -fpermissive -c

error: unknown argument: '-gnu-permissive'

$ icpx t4.cpp -fpermissive -c

error: unknown argument: '-gnu-permissive'


You can use -fgnu-keywords for Gnu extension with icpx instead

$ clang++ t4.cpp -c -fgnu-keywords

t4.cpp:5:9: error: cannot initialize a member subobject of type 'E' with an rvalue of type 'int'

A a = { 0 };

    ^

1 error generated.

$ icpx t4.cpp -c -fgnu-keywords

t4.cpp:5:9: error: cannot initialize a member subobject of type 'E' with an rvalue of type 'int'

A a = { 0 };

    ^

1 error generated.

$

Keep in mind that icpx is compatible with clang, so you may find issues when porting from icpc/g++ to icpx/clang.




Viet_H_Intel
Moderator
97 Views

This issue has been resolved in oneAPI  2021.1.2. We will no longer respond to this thread.  

If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.

Thanks,



Reply