This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in highest_pow2_factor
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 02 May 2002 11:55:21 -0700
- Subject: Re: Bug in highest_pow2_factor
- References: <10205021811.AA01141@vlsi1.ultra.nyu.edu>
--On Thursday, May 02, 2002 02:11:40 PM -0400 Richard Kenner
<kenner@vlsi1.ultra.nyu.edu> wrote:
> I found a bug in highest_pow2_factor yesterday while investigating an ICE
> in a proprietary Ada testcase.
>
> highest_pow2_factor is designed to always return a positive number,
> though it was not documented in that way. However, if it encounters a
> constant that is the most negative number, it will return that value,
> which is wrong.
It seems like you're assuming exp is always unsigned. So, why not
just return "unsigned HOST_WIDE_INT" from the function?
You already cast pow2 to that type in offset_address, so it looks
like the interface is wrong; these things should be unsigned in the
first place.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com