JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
C and C++


LANG.ARITH.FDIVZERO : Float Division By Zero

Summary

An attempt to perform floating-point division where the denominator evaluates to zero.

Properties

Class Name Float Division By Zero
Significance reliability
Mnemonic LANG.ARITH.FDIVZERO
Categories
MisraC2025 MisraC2025:1.3 There shall be no occurrence of undefined or critical unspecified behaviour
  MisraC2025:D.4.1 Run-time failures shall be minimized
MisraC2023 MisraC2023:1.3 There shall be no occurrence of undefined or critical unspecified behaviour
  MisraC2023:D.4.1 Run-time failures shall be minimized
Misra2012 Misra2012:1.3 There shall be no occurrence of undefined or critical unspecified behaviour
  Misra2012:D.4.1 Run-time failures shall be minimized
MisraC++2023 MisraC++2023:0.3.2 A function call shall not violate the function's preconditions
  MisraC++2023:4.1.3 There shall be no occurrence of undefined or critical unspecified behaviour
CWE CWE:369 Divide By Zero
  CWE:573 Improper Following of Specification by Caller
TS17961 TS17961:5.25-diverr Integer division errors
CERT-C CERT-C:INT33-C Ensure that division and remainder operations do not result in divide-by-zero errors
OWASP-2025 OWASP-2025:A10 Mishandling of Exceptional Conditions
Availability Available for C and C++.
Enabling Checks for this warning class are enabled by default. To disable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += discard class="Float Division By Zero"

Example

float fdivzero(void){
    float c = 5.0;
    float d;
    d = c*c - 20.0;
    return d/(d-c);    /* 'Float Division by Zero' warning issued here */
}

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.

 

To report problems with this documentation, please visit https://support.codesecure.com/.