DRS option is limited in Polyspace Code Prover
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Zulham Mr
el 28 de Mayo de 2022
Comentada: Zulham Mr
el 5 de Jun. de 2022
Hi guys,
I have this C++ code below:
void myfunc(int *arg, char *argv[])
{
if (*arg == 1)
*arg += 1;
char *p = argv[*arg];
if (p[0] == '-')
*arg += 1;
}
One of the Polyspace result is: Pointer may be outside its bounds. If appropriate, applying DRS to arg (argument number 1 of function myfunc(int *, char **), may remove this orange.
But when I tried to add and configure DRS, it has limited option as shown below:![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1014170/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1014170/image.png)
There are no other options. Init Mode, Init Range and Initialize Pointer are disabled in this case.
Thank you in advance.
0 comentarios
Respuesta aceptada
Anirban
el 1 de Jun. de 2022
Editada: Anirban
el 1 de Jun. de 2022
In C++, you cannot constrain pointer arguments of functions using this interface. See Constraint Specification Limitations. The message about DRS in the results is applicable to C code only.
To work around this limitation, you can write manual main()-s of the kind documented here. But depending on the kind of constraint you want to specify, it might be difficult to write an appropriate main(). If you contact MathWorks Technical Support and tell them what kind of constraint you want to specify, they might be able to help you setup this main() .
Más respuestas (0)
Ver también
Categorías
Más información sobre Code Prover Analysis in Polyspace Platform User Interface en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!