29.10.2014 Views

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Compiler</strong> Diagnostic Messages<br />

6.6 <strong>Compiler</strong> data flow warnings<br />

The compiler per<strong>for</strong>ms data flow analysis as part of its optimization process. This in<strong>for</strong>mation<br />

can be used to identify potential problems in your code, <strong>for</strong> example, to issue warnings about<br />

<strong>the</strong> use of uninitialized variables.<br />

The data flow analysis can only warn about local variables that are held in processor registers,<br />

not global variables held in memory or variables or structures that are placed on <strong>the</strong> stack.<br />

Be aware that:<br />

• Data flow warnings are issued by default. In RVCT v2.0 and earlier, data flow warnings<br />

are issued only if <strong>the</strong> -fa option is specified.<br />

• Data flow analysis is disabled at -O0, even if <strong>the</strong> -fa option is specified.<br />

The results of this analysis vary with <strong>the</strong> level of optimization used. This means that higher<br />

optimization levels might produce a number of warnings that do not appear at lower levels. For<br />

example, <strong>the</strong> following source code results in <strong>the</strong> compiler generating <strong>the</strong> warning C3017W: i<br />

may be used be<strong>for</strong>e being set, at -O2:<br />

int f(void)<br />

{<br />

int i;<br />

return i++;<br />

}<br />

The data flow analysis cannot reliably identify faulty code and any C3017W warnings issued by<br />

<strong>the</strong> compiler are intended only as an indication of possible problems. For a full analysis of your<br />

code, suppress this warning with --diag_suppress=C3017 and <strong>the</strong>n use any appropriate<br />

third-party analysis tool, <strong>for</strong> example Lint.<br />

6.6.1 See also<br />

Concepts<br />

• <strong>Compiler</strong> diagnostics on page 6-2.<br />

<strong>ARM</strong> DUI 0375C Copyright © 2007-2008, 2011 <strong>ARM</strong>. All rights reserved. 6-7<br />

ID061811<br />

Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!