This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in highest_pow2_factor




--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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]