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: Robert Dewar <dewar at gnat dot com>
- Cc: sabre at nondot dot org, gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Fri, 14 Feb 2003 10:07:18 -0800
- Subject: Re: [PATCH] Document arithmetic overflow semantics
- References: <20030214044537.6ED4AF2D6D@nile.gnat.com>
On Thu, Feb 13, 2003 at 11:45:37PM -0500, Robert Dewar wrote:
> > That's not really true... a straight-forward way to "fix" this problem is
> > to simply initialize all variables to, for example, zero. In almost all
> > cases, optimization would DCE this initialization anyway, so there is
> > really very little cost. The only major cases I can think of that the
> > initialization would not be killed would be something like this:
> Hmm, I am quite dubious about the claim that this would have zero overhead
> in practice, but if true, then I agree, it should be done.
The reason that it won't have zero overhead in practice is because gcc is
not yet as smart as it should be, even for scalars. For arrays, if you
force all elements of arrays to be initialized to zero, I doubt that gcc
will figure out that those initializations are dead in most cases.