Passing argument 3 of "ExtGetHostPkt" from incompatible pointer type [-Wincompatible-pointer-types]

Hello There
I’m new to the B&R Community and happy to be here :slight_smile:
I’m using target-for-Simulink to generate c-code from my Simulink model. The code generation works fine. I can generate the code from my model and download it to the plc. Also, the plc executes the code as wished. But in the build warnings, I get the above mentioned feedback. I have no idea how to prevent this from happening. An incompatible pointer sounds like it would be possible to access a location outside the variable boundaries itself. So should I be worried?
Im using Matlab 2023a and Automation Studio V4.12.5.95 SP with the GNU C compiler V6.3.0 and target-for-Simulink 6.8.0
Thanks for your inputs

1 Like

An incompatible pointer sounds like it would be possible to access a location outside the variable boundaries itself.

In C/C++, this build warning is triggered when there’s a difference between the pointer data type of the function’s definition and the value passed in code where the function in called.

The third argument of the ExtGetHostPkt function is expecting a pointer to an int.

In the generated code, it looks like the function is called with a value that is a pointer to int_T (and int_T is typedefed as long int, which is different than int).

So should I be worried?

No, but I would report this to your local B&R support team.
The function is authored by Mathworks, a reputable software company.

2 Likes

Hy @tmatijevich
Thanks for the reply.
Perfect, I will forward it to the B&R Support and post, if I get a solution.
In the meantime, it sounds not too problematic.

An incompatible pointer sounds like it would be possible to access a location outside the variable boundaries itself.

Maybe to answer your question better, it appears on most B&R targets - int and long int are the same size. That’s why your execution behavior was correct.

image

I cannot say for certain which compiler versions and which targets have matching sizes for int and long int. So I think it’s best to review with the product support team as you did.

1 Like