Semantic Checking - C

"johnvoltaire" <>
30 Jan 2005 13:14:04 -0500

          From comp.compilers

Related articles
Semantic Checking - C (johnvoltaire) (2005-01-30)
Re: Semantic Checking - C (2005-02-03)
Re: Semantic Checking - C (2005-02-03)
Re: Semantic Checking - C (Jeremy Wright) (2005-02-03)
Re: Semantic Checking - C (jacob navia) (2005-02-03)
Re: Semantic Checking - C (Neal Wang) (2005-02-03)
Re: Semantic Checking - C foobar@nowhere.void (Tommy Thorn) (2005-02-03)
[1 later articles]
| List of all articles for this month |

From: "johnvoltaire" <>
Newsgroups: comp.compilers
Date: 30 Jan 2005 13:14:04 -0500
Keywords: analysis, semantics, question
Posted-Date: 30 Jan 2005 13:14:04 EST

Hello! We need help.

1. We are trying to improve the semantic analysis of a particular
compiler, and we need to identify the errors that compilers usually
can or cannot detect. Please take time to review the following list of
errors we've gathered and check if any or all of them belongs to the
semantic checking routine during compilation/runtime. If you know a
specific semantic error that we missed, we'll appreciate it if you
could add the details.

2. The process we are planning to do is to make a static semantic
checking of C programs so that these kind of semantic errors would not
occur upon execution the program. This particular process is somewhat
like we can call as a diagnostic procedure that will walkthrough the
source code (without the necessity of running it) and see if any of
the statements will violate any semantic rules.

From what we've understand, static semantic checking refers to the
analysis of expected program meaning or flow before
compilation/execution, while dynamic semantic checking refers to the
analysis during execution. Could anyone affirm on these?

Is there anyone here that we could consult or discuss with regards to
this subject?

Good day to all and thanks in advance!

John Voltaire

Common semantic errors in C language:

1. Use of function without function prototypes
2. Code with no effect (dead code)
3. Division by zero
4. Use of functions and variables which are defined but not used
5. Use of functions and variables with defined arguments that are never
6. Use of functions and variables that return either with or without
any assigned value
7. Use of functions and variables that return values that are never
8. Subscript out of bounds
9. Booleans that always evaluate true or evaluate false
10. Checking of infinite loops as well as loops that cannot be exited
or entered
11. Statements that cannot be reached during execution
12. No identifiers or variables are used twice in the same block or
13. The number and types of arguments in a function call must be the
same as the number and types of the prototypes
14. A return statement must not have a return value unless it appears
in the function prototype that is declared to return a value
15. Break statements appear outside enclosing constructs where a break
statement may appear
16. Elements of enumerated types are repeated
17. Variable names appear in the same lexical scope
18. Labels are repeated

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.