From: Richard Biener <rguenther@suse.de>
To: Alexander Monakov <amonakov@ispras.ru>,Marek Polacek
<polacek@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Prevent extract_muldiv from introducing an overflow (PR sanitizer/80800)
Date: Fri, 19 May 2017 16:18:00 -0000 [thread overview]
Message-ID: <99083AD2-3C9E-470D-B68F-4E3B5C984B3E@suse.de> (raw)
In-Reply-To: <alpine.LNX.2.20.13.1705191833070.5721@monopod.intra.ispras.ru>
On May 19, 2017 5:47:10 PM GMT+02:00, Alexander Monakov <amonakov@ispras.ru> wrote:
>On Fri, 19 May 2017, Marek Polacek wrote:
>> > I think it's possible to keep this folding, note that it's valid to
>transform to
>> >
>> > (n * 1 * z) * 500000
>> >
>> > (i.e. accumulate multiplications on the outermost factor)
>
>(to be precise, if the multiplication is done in a signed type and the
>middle
>constant factor was a negated power of two, the sign change needs to
>remain:
>
> a * -4 * b * 2
>
>needs to be transformed to
>
> a * -1 * b * 8 )
>
>> > so would it be possible to adjust things here to remove the
>innermost
>> > multiplication instead?
>>
>> I think I'd rather not expand this function any more, sorry.
>
>I'd be happy to look into that myself, if the idea sounds feasible and
>desirable.
>I've never looked at this code before, so I'd appreciate a quick
>yay-or-nay
>before diving in. Richard, can you share your opinion on this point?
I'd rather extend the fold-binary associate: case to handle this, or do this via match.pd pattern(s).
Of course in the end we miss to associate signed integer ops in the reassoc pass...
Richard.
>Thanks.
>Alexander
next prev parent reply other threads:[~2017-05-19 16:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 7:21 Marek Polacek
2017-05-19 8:21 ` Richard Biener
2017-05-19 10:43 ` Marek Polacek
2017-05-19 10:57 ` Richard Biener
2017-05-19 10:59 ` Alexander Monakov
2017-05-19 15:36 ` Marek Polacek
2017-05-19 15:51 ` Alexander Monakov
2017-05-19 16:18 ` Richard Biener [this message]
2017-05-19 18:45 ` Joseph Myers
2017-05-19 20:06 ` Alexander Monakov
2017-05-24 8:11 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=99083AD2-3C9E-470D-B68F-4E3B5C984B3E@suse.de \
--to=rguenther@suse.de \
--cc=amonakov@ispras.ru \
--cc=gcc-patches@gcc.gnu.org \
--cc=polacek@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).