This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Document arithmetic overflow semantics
- From: Joe Buck <jbuck at synopsys dot com>
- To: Segher Boessenkool <segher at koffie dot nl>
- Cc: Robert Dewar <dewar at gnat dot com>, bosch at gnat dot com, gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org, kenner at vlsi1 dot ultra dot nyu dot edu
- Date: Tue, 18 Feb 2003 10:09:58 -0800
- Subject: Re: [PATCH] Document arithmetic overflow semantics
- References: <20030216124140.1F6D8F2D53@nile.gnat.com> <3E51B850.email@example.com>
> > Actually it is often very difficult to track down actions in a complex
> > optimization circuit that is manipulating some intermediate form to give
> > clear diagnostics, because the sequence of logic that arrives at a decision
> > may be arbitrarily complex, and it may be difficult for instance o tell
> > if the code in question is a direct consequence of the original source
> > code, or some code generated by some other optimization. Certainly there
> > is no requirement for a compiler to give such warnings.
On Tue, Feb 18, 2003 at 05:36:32AM +0100, Segher Boessenkool wrote:
> Of course, but I can't come up with an example where the
> compiler can't easily warn "unreachable code deleted".
> Can you?
I commonly write C++ templates that rely on constant folding for optimization.
The fact that unreachable code is deleted is a feature, not a bug, and any
compiler that insisted on warning me every time unreachable code is deleted
would be rejected as unusable.
Neverthess, redundant code is sometimes an indication that something is
wrong, but only when the code is redundant at source level when the values
of macros or the form of expanded templates is considered opaque. There's
a discussion of this in some of Dawson Engler's metacompilation papers.