public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Marek Polacek <polacek@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
	Richard Biener <richard.guenther@gmail.com>,
		GCC Patches <gcc-patches@gcc.gnu.org>,
	Nathan Sidwell <nathan@acm.org>,
		Richard Sandiford <richard.sandiford@arm.com>
Subject: Re: C++ PATCH to fix ICE with vector expr folding (PR c++/83659)
Date: Wed, 07 Feb 2018 18:24:00 -0000	[thread overview]
Message-ID: <CADzB+2k++UJig12MY6vxN2szuHuLoSvd8dwRT5C=v3KnXpi3eQ@mail.gmail.com> (raw)
In-Reply-To: <20180207175447.GD2608@redhat.com>

On Wed, Feb 7, 2018 at 12:54 PM, Marek Polacek <polacek@redhat.com> wrote:
> On Wed, Feb 07, 2018 at 12:26:04PM -0500, Jason Merrill wrote:
>> On Fri, Jan 26, 2018 at 6:22 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> > On Fri, Jan 26, 2018 at 02:11:19PM +0100, Richard Biener wrote:
>> >> >> POINTER_PLUS_EXPR offets are to be interpreted as signed (ptrdiff_t)
>> >> >> so using uhwi and then performing an unsigned division is wrong code.
>> >> >> See mem_ref_offset how to deal with this (ugh - poly-ints...).  Basically
>> >> >> you have to force the thing to signed.  Like just use
>> >> >>
>> >> >>   HOST_WIDE_INT offset = TREE_INT_CST_LOW (op01);
>> >> >
>> >> > Does it really matter here though?  Any negative offsets there are UB, we
>> >> > should punt on them rather than try to optimize them.
>> >> > As we known op01 is unsigned, if we check that it fits into shwi_p, it means
>> >> > it will be 0 to shwi max and then we can handle it in uhwi too.
>> >>
>> >> Ah, of course.  Didn't look up enough context to see what this code
>> >> does in the end ;)
>> >>
>> >> >           /* ((foo*)&vectorfoo)[1] => BIT_FIELD_REF<vectorfoo,...> */
>> >> >           if (VECTOR_TYPE_P (op00type)
>> >> >               && (same_type_ignoring_top_level_qualifiers_p
>> >> > -                (type, TREE_TYPE (op00type))))
>> >> > +                (type, TREE_TYPE (op00type)))
>> >> > +             && tree_fits_shwi_p (op01))
>> >>
>> >> nevertheless this appearant "mismatch" deserves a comment (checking
>> >> shwi and using uhwi).
>> >
>> > So like this?
>> >
>> > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>>
>> Why not use the same code as fold_indirect_ref_1 here?
>
> That was my first patch, but it was rejected:
> https://gcc.gnu.org/ml/gcc-patches/2018-01/msg00271.html

Then should we update fold_indirect_ref_1 to use the new code?  Is
there a reason for them to stay out of sync?

Jason

  reply	other threads:[~2018-02-07 18:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 16:31 Marek Polacek
2018-01-03 16:46 ` Nathan Sidwell
2018-01-03 18:00   ` Marek Polacek
2018-01-03 17:40 ` Richard Sandiford
2018-01-03 17:45   ` Marek Polacek
2018-01-05  8:52 ` Richard Biener
2018-01-25 15:10   ` Jakub Jelinek
2018-01-26 13:25     ` Richard Biener
2018-01-26 23:31       ` Jakub Jelinek
2018-02-07 17:26         ` Jason Merrill
2018-02-07 17:54           ` Marek Polacek
2018-02-07 18:24             ` Jason Merrill [this message]
2018-02-07 19:36               ` Marek Polacek
2018-02-07 21:43                 ` Jakub Jelinek
2018-02-07 20:23                   ` Jason Merrill
2018-02-07 20:43                     ` Jakub Jelinek
2018-02-07 20:53                       ` Jason Merrill
2018-02-07 22:43                         ` Jakub Jelinek
2018-02-07 21:22                           ` Jason Merrill
2018-02-08 16:37                             ` Jakub Jelinek
2018-02-08 12:30                               ` Marek Polacek
2018-02-08 14:56                               ` Jason Merrill
2018-02-08 10:15                       ` Richard Sandiford
2018-02-08 11:53                         ` Marek Polacek

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='CADzB+2k++UJig12MY6vxN2szuHuLoSvd8dwRT5C=v3KnXpi3eQ@mail.gmail.com' \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=nathan@acm.org \
    --cc=polacek@redhat.com \
    --cc=richard.guenther@gmail.com \
    --cc=richard.sandiford@arm.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).