No underflow checks in Polyspace Numerical Defects
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
In following link https://www.mathworks.com/help/bugfinder/numerical-checks.html, different overflow checks are listed, but no underflow checks.
That is why, for example, following will not be detected:
signed char foo = CHAR_MIN;
printf("foo: %d\n", foo);  // foo: -128
foo--;
printf("foo: %d", foo);  // foo: 127
Any idea on why that check is not available? 
0 comentarios
Respuesta aceptada
  Meet
 el 23 de Jul. de 2025
        Hi Ismet,
In C/C++, integer overflow and underflow on 2’s-complement signed types is undefined behavior, hence tools like Bug Finder can detect when a value goes beyond the representable range, limited by compile-time analysis or bounded checks.
Bug Finder does include a checker for CWE‑191 (Integer Underflow / Wraparound),  aimed at constant expressions or arithmetic that is statically analyzable.
For more information on this check, refer to the following MathWorks documentation: https://www.mathworks.com/help/bugfinder/ref/cwe191.html
I hope this helps!
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Bug Finder Analysis en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

