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

C compiler: missing diagnostics "dereferencing 'void *' pointer"

pmor
Beginner
340 Views

Sample code (t0.c):

void f(void* p)
{
	*p;
}

Invocation:

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

Expected diagnostics:

dereferencing 'void *' pointer

 Actual diagnostics:

<nothing>

Version:

icc 2021.5.0 on x86-64 on Linux

C11, 6.5.3.2 Address and indirection operators, Semantics, 4:

The unary * operator denotes indirection. If the operand points to a function, the result is a function designator; if it points to an object, the result is an lvalue designating the object.

C11, 6.3.2.1 Lvalues, arrays, and function designators, 1:

An lvalue is an expression (with an object type other than void) that potentially designates an object; ...

0 Kudos
5 Replies
MadhuK_Intel
Moderator
321 Views

Hi,


Thank you for posting in Intel Communities.


The issue raised by you is reproducible from our end with icc compiler.

Could you please try compiling with Intel C++ compiler 2022 (icx) instead?

The icx compiler is working as expected by throwing a warning as mentioned.


Thanks & Regards,

Madhu.


pmor
Beginner
315 Views

@MadhuK_Intel Update. Actually for the unary * operator there is no constraint "the operand shall not be a pointer to void" (or similar). One of the reasons is to support &*p. Hence, it seems that this issue is "not a problem". However, as a quality-of-implementation matter Intel C compiler can diagnose it.

pmor
Beginner
314 Views

The formatting is lost again: formatting_during_editing != formatting_after_saving. Please fix (if possible).

MadhuK_Intel
Moderator
284 Views

Hi Pavel,

 

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

 

>>"The formatting is lost again"

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

 

Best Regards,

Madhu

 

MadhuK_Intel
Moderator
206 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


Reply