Re: Semantic Checking - C (Nick Maclaren)
3 Feb 2005 22:39:40 -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)
Re: Semantic Checking - C (2005-02-11)
| List of all articles for this month |

From: (Nick Maclaren)
Newsgroups: comp.compilers
Date: 3 Feb 2005 22:39:40 -0500
Organization: University of Cambridge, England
References: 05-01-098
Keywords: analysis, semantics
Posted-Date: 03 Feb 2005 22:39:40 EST

johnvoltaire <> wrote:
>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. ...

Well, I could, but why should I do your work for you for no pay?
Being soft-hearted, I will do some of it.

>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. ...

As many compilers do, including gcc and most high-quality ones.

>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?

It is as good a set of definitions as any.

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

Almost certainly. But you should start by making it clear what basis
you are assuming - e.g. commercial consultancy, asking for free advice
or what.

>Common semantic errors in C language:
>1. Use of function without function prototypes
>2. Code with no effect (dead code)

Not errors and the former is always syntactic not semantic.

>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

Those (and others) are all syntactic errors where the C standard
requires the compiler to diagnose them statically.

Nick Maclaren.

Post a followup to this message

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