[PATCH] Fix ICE in predicate_mem_writes (PR tree-optimization/70725)
H.J. Lu
hjl.tools@gmail.com
Wed Apr 20 18:57:00 GMT 2016
On Wed, Apr 20, 2016 at 4:19 AM, Marek Polacek <polacek@redhat.com> wrote:
> On Wed, Apr 20, 2016 at 12:54:12PM +0200, Richard Biener wrote:
>> On Wed, Apr 20, 2016 at 12:37 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> > On Wed, Apr 20, 2016 at 11:04:08AM +0200, Richard Biener wrote:
>> >> > --- gcc/tree-if-conv.c
>> >> > +++ gcc/tree-if-conv.c
>> >> > @@ -262,6 +262,16 @@ ifc_temp_var (tree type, tree expr, gimple_stmt_iterator *gsi)
>> >> > return new_name;
>> >> > }
>> >> >
>> >> > +/* Return true when COND is a false predicate. */
>> >> > +
>> >> > +static inline bool
>> >> > +is_false_predicate (tree cond)
>> >> > +{
>> >> > + return (cond == NULL_TREE
>> >> > + || cond == boolean_false_node
>> >> > + || integer_zerop (cond));
>> >> > +}
>> >> > +
>> >
>> > Is it really a good idea to return true even for cond == NULL_TREE?
>> > I mean it is then very confusing, because both is_true_predicate and
>> > is_false_predicate are true in that case.
>>
>> Ah, indeed. NULL_TREE is true, not false.
>
> I can fix it up with the following.
>
> Bootstrap/regtest pending on x86_64-linux, ok for trunk and 6 if it passes?
>
> 2016-04-20 Marek Polacek <polacek@redhat.com>
>
> * tree-if-conv.c (is_false_predicate): For NULL_TREE return false
> rather than true.
>
> diff --git gcc/tree-if-conv.c gcc/tree-if-conv.c
> index a9fbab9..72e808e 100644
> --- gcc/tree-if-conv.c
> +++ gcc/tree-if-conv.c
> @@ -267,9 +267,9 @@ ifc_temp_var (tree type, tree expr, gimple_stmt_iterator *gsi)
> static inline bool
> is_false_predicate (tree cond)
> {
> - return (cond == NULL_TREE
> - || cond == boolean_false_node
> - || integer_zerop (cond));
> + return (cond != NULL_TREE
> + && (cond == boolean_false_node
> + || integer_zerop (cond)));
> }
>
> /* Return true when COND is a true predicate. */
>
> Marek
It leads to ICE on 32-bit x86 host:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70725#c8
--
H.J.
More information about the Gcc-patches
mailing list