This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix do_div() for all architectures
- From: Dale Johannesen <dalej at apple dot com>
- To: Bernardo Innocenti <bernie at develer dot com>
- Cc: Dale Johannesen <dalej at apple dot com>, Richard Henderson <rth at twiddle dot net>, Andrea Arcangeli <andrea at suse dot de>, Linus Torvalds <torvalds at osdl dot org>, linux-kernel at vger dot kernel dot org, Peter Chubb <peter at chubb dot wattle dot id dot au>, Andrew Morton <akpm at digeo dot com>, Ian Molton <spyro at f2s dot com>, gcc at gcc dot gnu dot org
- Date: Thu, 10 Jul 2003 12:53:44 -0700
- Subject: Re: [PATCH] Fix do_div() for all architectures
On Thursday, July 10, 2003, at 12:31 PM, Bernardo Innocenti wrote:
The compiler could easily tell what memory can be clobbered by a
pointer
by applying type-based aliasing rules. For example, a function taking a
"char *" can't clobber memory objects declared as "long bar" or
"struct foo".
No, for two reasons. First, anything can be aliased by a char. Second,
the restriction is on the type of the eventual memory reference,
not on the type of the pointer. Assuming an int* p, you can still do
*((char*)p) and
that may alias anything. So you must check each dereference; this
can't be
done easily at function entry.