Opened 8 years ago

Last modified 8 years ago

#3954 new defect

Potential bugs from static code analysis

Reported by: Henning Kiel Owned by: Lennart Ochel
Priority: normal Milestone: Future
Component: Code Generation Version: v1.10.0-dev-nightly
Keywords: Cc: Martin Sjölund, Adrian Pop

Description (last modified by Henning Kiel)

I'm referencing from run "Tue Jun 7 21:05:18 2016" with 3483 warnings
(approx. commit bb33335a639ba7a14c88f997355f1d41bfe37589)

I wonder if 3rdParty code should be checked, because we cannot do anything about it, right?

[ ] 1. virtually all files
(this is not a bug, but superfluous code, slowing down C compiler)
Common problem with match expressions "Value stored to 'tmp4' is never read" (because of failure handling?) creates hundreds of warnings and makes this static analysis difficult to read

[x] 2. Absyn.mo 3584
value stored to l2 is never read -> getCrefFromExp() stop expression is lost

[ ] 3. BackendDAEOptimize.mo 1763
value stored to compInfos is never read -> info from called function is lost, function returns defaults only

[x] 4. BackendDAEOptimize.mo 879
value stored to lsteqns is never read -> BackendEquation.equationList(eqns) called twice

[ ] 5. BackendDAEOptimize.mo 4350
value stored in expLst is never read -> list obtained from right side is directly overwritten by empty list

[ ] 6. BackendDAEDump.mo 888
value stored in expLst is never read -> string with equationKindString is not used

[ ] 7. BackendEquation.mo 1066,1055,1042
use of uninitialized variable b

[ ] 8. BackendInline.mo 792
output variable outEquationArray not initialized

[ ] 9. BackendVariable.mo 2891,2882,2898
value stored in res is never read -> call to replaceVarWithWholeDimSubs() seems useless

[ ] 10. BaseHashTable.mo 213
value stored in n is never read -> valueArrayLength() explicitly read but not used

[ ] 11. CevalFunction.mo 2672
value stored in deps is never read -> is this wanted?

[ ] 12. CevalFunction.mo 2310,1976,2280
value stored in cache is never read -> should following functions start with inCache or cache from previous call?

[ ] 13. Differentiate.mo 3052
lowerVarsElementVars() called with too few return elements

[ ] 14. EvaluateFunctions.mo 3383
returned list from List.filterOnTrue(varLst, BackendVariable.isStateorStateDerVar); is not used (and called function may not fail) -> superfluous?

[ ] 15. EvaluateFunctions.mo 1370
value of cref1 is overwriten 7 lines below

[ ] 16. Matching.mo 3867
value stored to unmatched is never read. Maybe typo in next line that should use unmatched instead of unmatchedRows (otherwise this listAppend() is superfluous)

[ ] 17. RemoveSimpleEquations.mo 3766
variable varlst is overwritten, maybe that should be iAcc = ??? And the recursion should use varlst (rest of list) and iAcc as parameters.

[ ] 18. ResolveLoops.mo 2456-2460
arrays e, u, v, vv and w are created but not used

[ ] 19. ResolveLoops.mo 1792+1793
arrays ass1 and ass2 are created, but not used

[ ] 20. ResolveLoops.mo 1564,1580
startNode/endNode is calculated twice with different rule

More to come (checked Compiler/boot/build/*.c alphabetically up to and including ResolveLoops.c, skipped HpcOM* and FFrontEnd)

Items marked with [x] are already fixed.

Change History (6)

comment:1 by Henning Kiel, 8 years ago

Cc: Martin Sjölund Adrian Pop added

comment:2 by Henning Kiel, 8 years ago

Description: modified (diff)

Added a few more items.

I see that some warnings are duplicated. Do they come from different stages of compilation?

comment:3 by Henning Kiel, 8 years ago

Description: modified (diff)

comment:4 by Henning Kiel, 8 years ago

Description: modified (diff)

comment:5 by Henning Kiel, 8 years ago

Description: modified (diff)

comment:6 by Henning Kiel, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.