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

Upgrade to icx cause a crash in compiled code

erling_andersen
New Contributor I
1,626 Views

I have been using icc for years and is now upgrading to icx 2021.3. Of course my code starts crashing.

 

Now somewhere in my code I does something like

 

s = calloc(1,sizeof(mystructtype));

/* some innocent code */

 

s->f = NULL;  /* It crashes both on Windows and Linux 64bit. */

 

It seems to be an alignment issue of s but I am not sure. That code using the classic 19.1 compiler  works perfectly.   So I wonder if there is something special for the Clang based compiler regarding structs.

 

I know it is hard for you to say anything wise, but maybe a bells ring.

 

 

 

 

 

 

0 Kudos
1 Solution
erling_andersen
New Contributor I
1,356 Views

I have worked on it but have not had success yet. Sorry.

 

I will accept this an answer and get back if I figure something out.

View solution in original post

0 Kudos
6 Replies
SantoshY_Intel
Moderator
1,590 Views

Hi,

 

Thanks for reaching out to us.

 

We have tried with the attached sample code using the icx 2021.3 compiler on Windows and Linux machines, but we didn't find any issues. Please refer to the screenshots attached.

MicrosoftTeams-image (19).pngMicrosoftTeams-image (20).png

 

 

Since we are not able to reproduce your issue at our end, could you please provide us a sample reproducer code along with the steps to reproduce your issue?

 

>>"s->f = NULL; /* It crashes both on Windows and Linux 64bit. */"

Could you please provide us a log/screenshot of the error encountered?

 

Thanks & Regards,

Santosh

 

 

 

 

0 Kudos
erling_andersen
New Contributor I
1,549 Views

I am working on a example code. It seems to happen if I allocate s such that

 

s%64==8

 

That is my hypothesis. Will keep you posted if I succeed.

 

 

0 Kudos
erling_andersen
New Contributor I
1,498 Views

One more observation:

  1. If I compile everything with '-O0' it does not crash.

  2. If I compile with '-O1' it crashes on an aligned store. Except if I add a printf just before the line that segfaults, then it works.

Seems like it must be some sort of compiler bug.

Otherwise there are some assumptions about the alignment of structs when optimization is enabled. But that seems strange to me.

0 Kudos
SantoshY_Intel
Moderator
1,375 Views

Hi,


We have tried compiling the sample code(attached in my previous post) with the options "-O0", "-O1", and "-O2". But, we didn't face any such crash issues.


So, could you please provide us a sample reproducer code? It would be helpful for us to investigate more on your issue.


Best Regards,

Santosh


0 Kudos
erling_andersen
New Contributor I
1,357 Views

I have worked on it but have not had success yet. Sorry.

 

I will accept this an answer and get back if I figure something out.

0 Kudos
SantoshY_Intel
Moderator
1,331 Views

Hi,


Sure, you can take your own time to get back to us.


Whenever it is possible for you to provide a sample reproducer, feel free to post a new question. We would be more than happy to help you there.


For the time being, we are closing this thread. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks & Regards,

Santosh


0 Kudos
Reply