Re: Improved C warning messages

fjh@cs.mu.OZ.AU (Fergus Henderson)
29 Apr 1999 00:31:56 -0400

          From comp.compilers

Related articles
Improved C warning messages mikov@usa.net (Tzvetan Mikov) (1999-04-22)
Re: Improved C warning messages jejones@microware.com (James Jones) (1999-04-26)
Re: Improved C warning messages gopi@sankhya.com (1999-04-26)
Re: Improved C warning messages rinie4384@my-dejanews.com (1999-04-26)
Re: Improved C warning messages fjh@cs.mu.OZ.AU (1999-04-29)
Re: Improved C warning messages mikov@usa.net (Tzvetan Mikov) (1999-04-29)
Re: Improved C warning messages mikov@usa.net (Tzvetan Mikov) (1999-04-29)
Re: Improved C warning messages saroj@bear.com (1999-04-30)
| List of all articles for this month |

From: fjh@cs.mu.OZ.AU (Fergus Henderson)
Newsgroups: comp.compilers
Date: 29 Apr 1999 00:31:56 -0400
Organization: Computer Science, The University of Melbourne
References: 99-04-080 99-04-088
Keywords: C, errors

> [ re not generating useless errors for widened and narrowed types ]
>In the parse tree at each node, you could maintain in addition to the type of
>the expression, the smallest data type that is known to hold the value without
>losing any information. This can then be used to decide on whether or not
>a particular warning should be issued.


Yes. A fairly straight-forward analysis using _abstract
interpretation_ will yield that information. (If you don't know what
abstract interpretation is, a web search will probably pull up some
useful references.) It might be better to use integer ranges for your
abstract domain, rather than using data types, because integer range
information is often useful for optimization purposes too, for example
for omitting array bounds checks. But using data types for your
abstract domain does make it easy to keep a simple and clean
separation between the front-end and the back-end.


--
Fergus Henderson <fjh@cs.mu.oz.au>
WWW: <http://www.cs.mu.oz.au/~fjh>
PGP: finger fjh@128.250.37.3


Post a followup to this message

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