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

C compiler: missing diagnostics "a return statement with an expression shall not appear in a functio

pmor
Beginner
690 Views

Sample code:

 

extern volatile void x;
void f(void)
{
	return x;
}

 

Invocation:

 

$ icc t0.c -std=c11 -pedantic -Wall -Wextra -c

 

Expected diagnostics:

 

warning: a return statement with an expression shall not appear in a function whose return type is void

 

 Actual diagnostics:

 

t0.c(1): warning #21: type qualifiers are meaningless in this declaration
  extern volatile void x;
                       ^

": internal error: ** The compiler has encountered an unexpected problem.
** Segmentation violation signal raised. **
Access violation or stack overflow. Please contact Intel Support for assistance.

 

Version:

 

icc 2021.5.0 on x86-64 on Linux

 

0 Kudos
6 Replies
pmor
Beginner
685 Views

Also: the editor inserts unwanted:

<p>&nbsp;</p>
<p>&nbsp;</p>

Even if they have been manually removed, then the editor still inserts (it seems on "Save edits" operation) them.
Please fix.

0 Kudos
MadhuK_Intel
Moderator
653 Views

Hi,

 

Thanks for reaching out to us.

 

>"Expected diagnostics: warning: a return statement with an expression shall not appear in a function whose return type is void"

 

Could you please let us know the standard reference based on which you are mentioning expected behavior so that we could consider your error/warning description?

 

>"Also: the editor inserts unwanted:

<p>&nbsp;</p>

<p>&nbsp;</p>"

 

Could you please elaborate on the issue, and please provide more information regarding the same so that we could investigate it.

 

 

Thanks & Regards,

Madhu.

 

0 Kudos
pmor
Beginner
647 Views

@MadhuK_Intel 
C11, 6.8.6.4 The return statement, Constraints, 1
> A return statement with an expression shall not appear in a function whose return type is void.

 

About: "the editor inserts unwanted". After the post has been edited, and saved via "Save edits", the final post contains `<p>&nbsp;</p>`, which were _not_ present in the post. It seems that they have been auto-inserted on "Save edits".

 

0 Kudos
MadhuK_Intel
Moderator
569 Views

Hi Pavel,

 

>>"C11, 6.8.6.4 The return statement, Constraints, 1"

We have reported this issue to the concerned development team. They are looking into your issue.

 

>>"the editor inserts unwanted"

We could not see such an issue now. Please do check and let us know if you still face the issue.

 

Best Regards,

Madhu

 

0 Kudos
MadhuK_Intel
Moderator
538 Views

Hi Pavel,

 

Not sure if you are aware of it, but the Intel C++ Classic compiler will enter "Legacy Product Support" mode signaling the end of regular updates. Please see the below article for more details.

https://www.intel.com/content/www/us/en/developer/articles/technical/adoption-of-llvm-complete-icx.h...

 

So we suggest you try with the Intel C++ Compiler 2022 (icx) as it is working as expected when we checked it from our end.

 

Best Regards,

Madhu

 

0 Kudos
MadhuK_Intel
Moderator
473 Views

Hi,


The version against which you reported your issue is no longer targeted for fixes. Please check out the new versions of Intel oneAPI Toolkits for the latest features. Please post a new question if you need any additional information from Intel, as this thread will no longer be monitored.


Best regards,

Madhu




0 Kudos
Reply