.

Release Notes: CODESYS Static Analysis 5.1.0.0

Key Issue Type Summary Resolution Note
SAN-1605 Bug

Internal error with Possible truncated strings

Fixed
SAN-1596 Bug

SA0033: False positive for array defined via VAR_GENERIC CONSTANT which is used in sub FB

Cannot Reproduce [[GENERAL]]
The cause of this error is a missing cross-reference, this bug has been fixed with compiler version 3.5.22.0.
SAN-1595 Bug

Execution of SAN returns errors in a library project only after the code analysis

Duplicate [[GENERAL]]
Duplicated SAN-1579: Running SAN in a library generates compile errors
SAN-1594 Bug

Uncaught exception in CheckInitialValue

Fixed
SAN-1593 Bug

SA0077: A False positive is given, if CASE variable is a VAR_IN_OUT variable

Fixed
SAN-1592 Bug

SA0038 False Positive for SA0038 ADR + SIZEOF

Fixed [[GENERAL]]
ADR, SIZEOF, XSIZEOF, __ISVALIDREF and __VARINFO are no longer considered in this check
SAN-1591 Bug

False Positive: SA0019 with alias

Fixed
SAN-1590 Bug

SA0040: false negativ for change of variable after condition check

Fixed
SAN-1589 Bug

SA0040: False Positive possible division by zero

Won't Fix [[GENERAL]]
This is an accepted false positive, we recommend to refactor the complex control flow in the described way to make the code more readable for computers and humans.
SAN-1587 Bug

Internal error/NotImplementedException in array bounds check

Cannot Reproduce [[GENERAL]]
Could not reproduced starting with 5.1.0.0 anymore
SAN-1584 Bug

SA0029: Ignore quickfixes don't work

Fixed
SAN-1583 Bug

Wrong result reported for compare on BYTE in some cases

Fixed [[GENERAL]]
Casts of unsigned types now correctly handle overflows in the constant propagation.
SAN-1581 Bug

False Positive, SA0140: Statement commented out is reported for many slashes

Fixed
SAN-1580 Bug

False positive for SA0172

Cannot Reproduce
SAN-1579 Bug

Running SAN in a library generates compile errors

Fixed
SAN-1571 Bug

Forbidden Symbols Table accepts empty string as a node

Fixed
SAN-1568 Bug

SAN 5.0: CODESYS freezes when running SAN with attached project

Fixed
SAN-1567 Bug

SAN 5.0: Light errors and NC errors are missing in precompile if not at least one "full rule" (not Light) is activated

Fixed
SAN-1566 Bug

SA0025: False positive for implicit enums

Fixed
SAN-1565 Bug

SA0040: Different behavior in CFC than in ST

Fixed [[GENERAL]]
The CFC code in the example is not structurally the same as the Structured Text code. Since there are limits for the Constant Propagation, there always can be some differences between CFC and Structured Text.
With the fix of this issue, CFC will in many cases be treated similar to Structured Text. But there are still limits.
For example: the CFC generates a lot of temporary variables, and the behaviour of boxes with EN only affects this box, and not inputs to the box. The order of execution of Operations might be unexpected.

The following ST code for example:
IF lrtest <> 0 THEN
x := x / (lrtest * 4);
END
written in CFC with an EN-Input for the DIV-Box might produce code like this:

__temp1 := lrtest * 4;
__temp2 := lrtest <> 0;
IF __temp2 THEN
x := x / __temp1;
END_IF

This code will produce a "possible division by zero" also in structured text.
We created a new issue for this situation: SAN-1589, but it is probably a situation that we won't fix.
SAN-1564 Bug

SA0040: Second occurrence in IF statements is skipped

Fixed
SAN-1563 Bug

False Positive for SA0002 for non-empty SFC action

Fixed
SAN-1562 Bug

SA0040 is reported for MOD

Won't Fix [[GENERAL]]
According to the standard IEC 61131 MOD is equivalent to OUT:=IN1-(IN1/IN2)*IN2, where a division by 0 might occur
SAN-1558 Improvement

[Technical Debt] StaticAnalysisManager: Replace SandBar stuff by standard means

Fixed
SAN-1554 Bug

Array access: Index bounds check is not recognized

Fixed
SAN-1553 Bug

SA0063: Possibly truncated intermediate result not reported

Fixed
SAN-1552 Bug

Internal error in CognitiveComplexityCalculator

Fixed
SAN-1551 Bug

Internal errors: Stack Empty

Fixed
SAN-1546 Bug

Unexpected Build errors when running static analysis

Won't Fix [[GENERAL]]
Won't fix, because the error message is justified.
The library contains errors in visualizations.
The "build" message category shows the corresponding error messages for the erroneous expressions
SAN-1545 Bug

SA0062: False negatives for expressions with TRUE/FALSE if variable checked beside of that has not been written before

Fixed [[GENERAL]]
Resolved false negatives in operator expressions due to only looking at values from the constant propagation.
Changed error message from "[variable in operator expression] is always [TRUE/FALSE]" to "[operator expression] is always [TRUE/FALSE]" to be more understandable.
SAN-1544 Improvement

Extract Declaration Hides Symbol to PrecompileChecker

Fixed [[GENERAL]]
Fixed Declaration Hides Symbol (SA0013) bugs when working with multiple levels of inheritance.
SAN-1543 Improvement

[Technical debt] Move methods of class Common to using class

Fixed
SAN-1541 Bug

Internal error in library because of whiteparsetrees

Fixed
SAN-1535 Improvement

Convert some SAP Precompile checks to own PrecompileCheckers

Fixed
SAN-1534 Improvement

Refactor Common.cs

Fixed
SAN-1531 Bug

Librarys: False positives in older Codesys Compiler Version when analyzing

Cannot Reproduce [[GENERAL]]
Not reproducible with 5.1.0.0
SAN-1526 Bug

SA0035: Input variables of FB used parent FB are detected as false positive

Won't Fix [[GENERAL]]
Won't fix, because the error messages are justified.
According to the online help ("Detects the input variables which are not used by any function block instance")
passing values to the input variables is no access to the input variables within the declaring function block.
SAN-1525 Improvement

Refactoring: Extract Empty Statement checks out of StaticAnalysisPrecompileVisitor)

Fixed
SAN-1519 Bug

FalsePositive: "Unused" Variables in interface methods should not be reported

Fixed
SAN-1518 Improvement

Refactoring: Extract operator expression checks out of StaticAnalysisPrecompileVisitor (2)

Fixed
SAN-1517 Improvement

Refactoring: Extract operator expression checks out of StaticAnalysisPrecompileVisitor

Fixed
SAN-1516 Improvement

Refactoring: Extract SAN checks from StaticAnalysisExprVisitor

Fixed
SAN-1515 Improvement

Refactoring: Move IVariableExpression checks to already existing PrecompileChecker

Fixed
SAN-1514 Improvement

Use deferred installation again after CDS-80035 was fixed

Fixed
SAN-1513 Improvement

Change package.manifest encoding to utf8

Fixed
SAN-1504 Improvement

SA0161: Report for inheritance from unpacked structures

Fixed
SAN-1500 Improvement

Refactoring: Move other part of SA0119ProhibitObjectOrientedFeatures to already existing PrecompileChecker

Fixed
SAN-1499 Improvement

Refactoring: Move other part of SA0107UseFormalParameters to already existing PrecompileChecker

Fixed
SAN-1498 Improvement

Refactoring: Move SA0073UseAdequateForCounterVariable to separate PrecompileChecker

Fixed
SAN-1497 Improvement

Refactoring: Move multiple small Checks to separate PrecompileCheckers

Fixed
SAN-1489 Improvement

Refactoring: Move UnusualBitAccess checks to separate PrecompileCheckers

Fixed [[GENERAL]]
Now messages from both SA0018 and SA0148 will be shown if they are activated at the same time.
SAN-1488 Improvement

Refactoring: Finish Conversion of SA0025QualifiedEnumsPrecompileChecker

Fixed
SAN-1487 Improvement

Refactoring: Move SA0075CaseStatementMissingElse to separate PrecompileChecker

Fixed
SAN-1486 Improvement

Refactoring: Move SA0076CaseStatementMissingEnum to separate PrecompileChecker

Fixed
SAN-1485 Improvement

Refactoring: Move SA0078CaseStatementWithoutCase to separate PrecompileChecker

Fixed
SAN-1484 Improvement

Refactoring: Move SA0120ProhibitProgramCalls to separate PrecompileChecker

Fixed
SAN-1482 Improvement

Refactoring: Move SA0017SuspiciousAssignment to separate PrecompileChecker

Fixed
SAN-1481 Improvement

Refactoring: Move SA0021TransportingTemporaryAddress to separate PrecompileChecker

Fixed
SAN-1475 Bug

False positive index access error for INT-variables

Duplicate [[GENERAL]]
Duplicate of SAN-1554
SAN-1472 Improvement

Refactoring: Move ForCounterUsed to seperate PrecompileChecker

Fixed [[GENERAL]]
SA0072 will no longer be reported for complex counters like component and index-accesses, in these cases SA0073 will be reported instead
SAN-1471 Improvement

Refactoring: Move PossibleStringTruncation to seperate PrecompileChecker

Fixed
SAN-1470 Bug

SANUnittestHelper: change back to NonDeferred installation

Fixed
SAN-1468 Improvement

Refactoring: Move UnusalShiftOperationStrict & UnusalShiftOperation to seperate PrecompileChecker

Fixed
SAN-1467 Improvement

Refactoring: Move AssignmentOfInstances to seperate PrecompileChecker

Fixed
SAN-1466 Improvement

Refactoring: Move ImplicitPointerConversion to seperate PrecompileChecker

Fixed
SAN-1437 Bug

NC0009 for VAR_EXTERNAL

Fixed
SAN-1436 Bug

Static Analysis Full\NC0061: No error position for VAR_TEMP variables

Cannot Reproduce
SAN-1435 Bug

Static Analysis Full\Attributes: {attribute 'naming' := 'omit'} does not work in VAR_TEMP section

Cannot Reproduce [[GENERAL]]
Cannot be reproduced with Version 5.1.0.0
SAN-1434 Improvement

Remove dead code in StaticAnalysisManager

Fixed
SAN-1422 Improvement

Add command to apply quick for whole project

Fixed
SAN-1178 Epic

Support the SARIF File Format for Analyzation results

Duplicate [[GENERAL]]
Duplicates SAN-1002
SAN-1002 Epic

Automatic machinereadable export/import of SAN results

Fixed
SAN-905 Improvement

Static Analysis: Ambiguous variable names are not sufficiently reported by SA0013/SA0027 for (global) project and library variables

Fixed [[GENERAL]]
SA0013 and SA0027 is reported for symbols from libraries.
Added a new command in SA0013 context menu to jump to the shadowed symbol.
SAN-876 Bug

Rule for unused variable creates high cpu usage in idle when editor with many variables is active

Fixed
SAN-869 Bug

VAR_CONFIG variables are always shown as unused (SA0033)

Fixed
SAN-862 Improvement

It should be easy to get from a metric entry to the corresponding POU

Duplicate [[GENERAL]]
Duplicate of SAN-794
SAN-856 Bug

Rule 00006 can not be suppressed

Fixed [[GENERAL]]
Warning can be suppressed with the analysis attribute (e.g. {attribute 'analysis':='-6'}) at the declaration of the pou.
The analysis pragma in the implementation is not supported
SAN-847 Bug

SAN: Does not work if the global variable "VERSION_FORCETORQUEINTERFACE : BOOL;" is defined in a library

Cannot Reproduce [[GENERAL]]
Cannot be reproduced with version 5.1.0.0
SAN-824 Bug

Error message 'InternalStaticAnalysisDevice already exists'

Cannot Reproduce
SAN-794 Improvement

Metrics View: Open POU on double-click in row

Fixed
SAN-617 Bug

SA0140: Is missing for pragma {error 'XYZ'}

Fixed
SAN-506 Bug

S0032: Unused enum constant cannot be deactivated individually

Won't Fix [[GENERAL]]
In the declaration part, attributes must be used to suppress errors, the analysis pragma can only be used in the implementation of POUs.
SAN-501 Improvement

New metric: Maintainability index

Won't Fix
SAN-497 Bug

SA0077 not reported: type mismatch for CASE-variable

Fixed [[GENERAL]]
Renamed name and error message of SA0077 to "Enum type mismatch with CASE expression"
SAN-495 Bug

StaticCodeAnalysis: issues in hided local variables are not reported

Won't Fix [[GENERAL]]
This works as designed. conditional_show should be used instead of hide to allow for more fine-grained control of visibility.
SAN-437 Bug

No shadowing reported for application variables that hide library variables

Duplicate [[GENERAL]]
Duplicates SAN-905
SAN-436 Bug

No shadowing reported for application variables that hide library variables

Duplicate [[GENERAL]]
Duplicates SAN-905
SAN-396 Bug

Static Analysis Full\Attributes: Turning naming prefix check on and off again may not work (attribute 'naming' := 'on'/'off')

Won't Fix [[GENERAL]]
Attributes must be unique per variable, this is a general limition of the compiler. Since the code described in this issue can easily be rewritten with a single naming off attribute, we chose to keep the current behaviour.
SAN-359 Bug

Static Analysis Full\SA0026: Error position not defined if assigning FB input within FB call

Cannot Reproduce [[GENERAL]]
Cannot be reproduced with 5.1.0.0 anymore
SAN-337 Improvement

SAN Pro - Forbidden symbols: New line should be focused when it is automatically added after symbol entry

Fixed [[GENERAL]]
After adding a new symbol, the new line entry will be selected.
After adding a new symbol which is already defined in the set, the new entry will be discarded and the already existing symbol will be selected.
After editing an existing symbol, the existing symbol will stay selected.
After deleting a symbol, the current selection position will stay selected.
SAN-336 Bug

SAN Pro - Forbidden symbols: Same symbols can be entered multiple times

Fixed
SAN-334 Improvement

SAN Pro - Rules: Add possibility to optionally order the rules according to the rule numbers

Cannot Reproduce [[GENERAL]]
The rules can be switched to ListView it is then possible to sort by any column.
SAN-319 Improvement

New Rule for possible wrong index access

Cannot Reproduce [[GENERAL]]
Implemented rule SA0172 with 5.0.0.0
SAN-312 Bug

Naming conventions: Missing possibility to configure naming convention for VAR_INST

Fixed [[GENERAL]]
Add naming convention rules for VAR_INST
SAN-288 Bug

Contextmenu "Open POU" in metrics table not disabled for compiled library POUs

Cannot Reproduce [[GENERAL]]
Starting with V4 SP3 metrics of compiled-library objects are no longer computed/displayed, because the user has no possibility to change anything, that will be reported.
SAN-149 Improvement

Tool support to fix Static Analysis Warnings

Cannot Reproduce