What is the difference between static analysis and semantic analysis?

A look at table 9 in ISO 26262-6 (2011) Functional safety of a road vehicle. Part 6 Product development, static code analysis (1g), and semantic code analysis (1h) are listed separately as verification methods.

I was looking for an explanation of the differences, but I did not find anything pleasant.

Is it possible to simplify the statement that static analysis can use semantic analysis, but not necessarily vice versa?

In general, what is the difference between static analysis and semantic analysis?

Most of the descriptions of static analysis that I have seen seem to include a discussion of semantic analysis. What is static code analysis?

Thank you for your time and any possible ideas and feedback.

+4
source share
3 answers

If you look closely at table 9, you will see: 1h | Parsing semantic code ^ d

Below you can read what “^ d” means: Method 1h is used to mathematically analyze the source code using an abstract representation of the possible values ​​for the variables ...

There are software tools that provide such an analysis, i.e. Polyspace Proover.

+2
source

Semantic analysis is performed during compilation by most compilers, and the goal is to check whether to read or not to execute code that conforms to the specification of a programming language. Usually it checks the correctness of the type, the existence of the method, etc.

- , , .., . , .

, , PVS-Studio, Intellij Idea ..

, .

+1

, , . , .

, ( ) . , .

In most cases, simply speaking, semantic or parsing implies that it is also a static analysis.

For example, assuming that the C compiler throws two errors: “missing semicolon” ​​and “unused variables”, the first is the result of (static) parsing, and the last is the result of (static) semantic analysis performed by the compiler.

+1
source

All Articles