5.6 Compiler data flow warnings

The compiler performs data flow analysis as part of its optimization process. This information can help identify potential problems in your code, for example, issuing warnings about the use of uninitialized variables.

The data flow analysis can only warn about local variables that are held in processor registers, not global variables held in memory or variables or structures that are placed on the stack.
Be aware that:
  • In ARM Compiler 5.04 and later, data flow warnings are suppressed by default. To output them, use the --diag_warning=4017 option. In RealView Compiler Tools (RVCT) v2.0 and earlier, data flow warnings are issued only if you specify the -fa option.
  • Data flow analysis is disabled at optimization level -O0, even if you specify --diag_warning=4017.
For example, the following code produces the warning C4017W: i may be used before being set, if you have enabled it, when compiling at -O1 and above:
int f(void)
{
    int i;
    return i++;
}
The results of the analysis vary with the level of optimization used. This means that higher optimization levels might produce a number of warnings that do not appear at lower levels.
The data flow analysis cannot reliably identify faulty code and any C4017W warnings issued by the compiler are intended only as an indication of possible problems. For a full analysis of your code, use an appropriate third-party analysis tool, for example Lint.
Related concepts
5.2 Options that change the severity of compiler diagnostic messages
5.3 Controlling compiler diagnostic messages with pragmas
5.4 Prefix letters in compiler diagnostic messages
5.5 Compiler exit status codes and termination messages
Related reference
5.1 Severity of compiler diagnostic messages
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.