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: [PATCH] Fix PR 37782, Stage2 ada compiler miscompiled


On Fri, Oct 31, 2008 at 6:42 PM,  <Andrew_Pinski@playstation.sony.com> wrote:
> "Richard Guenther" <richard.guenther@gmail.com> wrote on 10/31/2008
> 03:42:37 AM:
>
>> On Fri, Oct 31, 2008 at 2:48 AM, Andrew Pinski
>> <Andrew_Pinski@playstation.sony.com> wrote:
>> > Hi,
>> >  The problem here is that in some cases doloop_modify will do the
>> > addition in the wrong mode, causing to get the wrong answer; this only
>> > happens if zero_extend_p is true which was added by me to that removes
>> > an addition in some cases.  This fixes the problem by adding an
>> > argument to doloop_modify which says the original mode of count and
>> > does the addition in that mode.
>> >
>> > OK?  Bootstrapped and tested on powerpc64-linux-gnu with no
>> > regressions (but no Ada).  Also tested by Andreas Schwab on
>> > powerpc64-linux-gnu with no regressions for Ada.
>>
>> Hum, why use the mode of the counter register inside the comparison and
>> not simply the mode of count which you increment?  Thus
>>
>>   if (increment_count)
>>     count = simplify_gen_binary (PLUS, GET_MODE (count), count,
> const1_rtx);
>>
>> IMHO that more obviously matches and removes the need for the extra
> parameter?
>
> count here can be a const_int which will have a VOIDmode which can and
> will ICE.  That is the problem in the first place, it is a constant which
> is QImode.  Since const_int don't really have a mode, we already lost
> which mode the addition should be done in, that is why there needs to be
> an extra argument.

Hmm, that sucks ;)  You patch is ok then.

Thanks,
Richard.


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