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 undefined behavior in IRA


On Wed, Mar 26, 2014 at 10:27:37PM +0100, Marc Glisse wrote:
> On Tue, 25 Mar 2014, Marek Polacek wrote:
> 
> >This is a temporary fix for UB in IRA, where ubsan complains because
> >there's signed iteger overflow in the multiplication.  To shut this
> >error up, we can perform the multiplication in unsigned and only then
> >cast the result of the multiplication to int.
> 
> Naive question: why do you want to shut the error up? If modular
> arithmetic makes sense for costs (sounds doubtful), they should use
> an unsigned type to begin with. Otherwise, this is making it harder
> to notice a bug (doesn't sound like an improvement).

Because it makes bootstrap-ubsan pretty much useless, e.g. in the testsuite
almost all tests fail because of this.

AFAIK Vlad is aware of this, and if it isn't tracked in some bug, it should
be that it should be investigated.
In PR59545 I've mentioned also other ira issues with ub, if I remember well
it was two other places, but the ira-color.c case has been orders of
magnitude more common.

	Jakub


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