This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix undefined behavior in IRA
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Marek Polacek <polacek at redhat dot com>, Vladimir Makarov <vmakarov at redhat dot com>
- Date: Wed, 26 Mar 2014 22:33:07 +0100
- Subject: Re: [PATCH] Fix undefined behavior in IRA
- Authentication-results: sourceware.org; auth=none
- References: <20140325161421 dot GS6523 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1403262217080 dot 3634 at laptop-mg dot saclay dot inria dot fr>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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